diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-06-12 16:43:49 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-06-12 16:47:46 +0200 |
| commit | d3b4d7da9a801dac3af6a3cf52eb55af83adc5f5 (patch) | |
| tree | 72ab79ed75dddfb7b97ddf02ba4d19c4efc9ea5a /library/src/layout | |
| parent | 378ebe5f5601f11c3f428c17bed492012feb251e (diff) | |
More `bail!` usage
Diffstat (limited to 'library/src/layout')
| -rw-r--r-- | library/src/layout/enum.rs | 2 | ||||
| -rw-r--r-- | library/src/layout/list.rs | 2 | ||||
| -rw-r--r-- | library/src/layout/page.rs | 2 | ||||
| -rw-r--r-- | library/src/layout/terms.rs | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/library/src/layout/enum.rs b/library/src/layout/enum.rs index 2204b284..91866d15 100644 --- a/library/src/layout/enum.rs +++ b/library/src/layout/enum.rs @@ -294,7 +294,7 @@ cast! { let mut iter = array.into_iter(); let (number, body) = match (iter.next(), iter.next(), iter.next()) { (Some(a), Some(b), None) => (a.cast()?, b.cast()?), - _ => Err("array must contain exactly two entries")?, + _ => bail!("array must contain exactly two entries"), }; Self::new(body).with_number(number) }, diff --git a/library/src/layout/list.rs b/library/src/layout/list.rs index a11b019f..9dce466d 100644 --- a/library/src/layout/list.rs +++ b/library/src/layout/list.rs @@ -216,7 +216,7 @@ cast! { v: Content => Self::Content(vec![v]), array: Array => { if array.is_empty() { - Err("array must contain at least one marker")?; + bail!("array must contain at least one marker"); } Self::Content(array.into_iter().map(Value::display).collect()) }, diff --git a/library/src/layout/page.rs b/library/src/layout/page.rs index 9789b468..3b81f92c 100644 --- a/library/src/layout/page.rs +++ b/library/src/layout/page.rs @@ -595,7 +595,7 @@ cast! { v: GenAlign => match v { GenAlign::Specific(Align::Left) => Self::Left, GenAlign::Specific(Align::Right) => Self::Right, - _ => Err("must be `left` or `right`")?, + _ => bail!("must be `left` or `right`"), }, } diff --git a/library/src/layout/terms.rs b/library/src/layout/terms.rs index 8b8a7223..d693f100 100644 --- a/library/src/layout/terms.rs +++ b/library/src/layout/terms.rs @@ -158,7 +158,7 @@ cast! { let mut iter = array.into_iter(); let (term, description) = match (iter.next(), iter.next(), iter.next()) { (Some(a), Some(b), None) => (a.cast()?, b.cast()?), - _ => Err("array must contain exactly two entries")?, + _ => bail!("array must contain exactly two entries"), }; Self::new(term, description) }, |
