diff options
| author | PgBiel <9021226+PgBiel@users.noreply.github.com> | 2025-06-10 11:41:16 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-10 14:41:16 +0000 |
| commit | 7c7b962b98a09c1baabdd03ff4ccad8f6d817b37 (patch) | |
| tree | c44c9b82e3c7ec7bf8feb44cedeae9fa71a107cb /crates/typst-utils/src | |
| parent | a18ca3481da17a4de1cc7f9890f0c61efb480655 (diff) | |
Table multiple headers and subheaders (#6168)
Diffstat (limited to 'crates/typst-utils/src')
| -rw-r--r-- | crates/typst-utils/src/lib.rs | 11 | ||||
| -rw-r--r-- | crates/typst-utils/src/pico.rs | 5 |
2 files changed, 7 insertions, 9 deletions
diff --git a/crates/typst-utils/src/lib.rs b/crates/typst-utils/src/lib.rs index b346a809..abe6423d 100644 --- a/crates/typst-utils/src/lib.rs +++ b/crates/typst-utils/src/lib.rs @@ -26,7 +26,7 @@ pub use once_cell; use std::fmt::{Debug, Formatter}; use std::hash::Hash; use std::iter::{Chain, Flatten, Rev}; -use std::num::NonZeroUsize; +use std::num::{NonZeroU32, NonZeroUsize}; use std::ops::{Add, Deref, Div, Mul, Neg, Sub}; use std::sync::Arc; @@ -66,10 +66,11 @@ pub trait NonZeroExt { } impl NonZeroExt for NonZeroUsize { - const ONE: Self = match Self::new(1) { - Some(v) => v, - None => unreachable!(), - }; + const ONE: Self = Self::new(1).unwrap(); +} + +impl NonZeroExt for NonZeroU32 { + const ONE: Self = Self::new(1).unwrap(); } /// Extra methods for [`Arc`]. diff --git a/crates/typst-utils/src/pico.rs b/crates/typst-utils/src/pico.rs index 2c80d37d..ce43667e 100644 --- a/crates/typst-utils/src/pico.rs +++ b/crates/typst-utils/src/pico.rs @@ -95,10 +95,7 @@ impl PicoStr { } }; - match NonZeroU64::new(value) { - Some(value) => Ok(Self(value)), - None => unreachable!(), - } + Ok(Self(NonZeroU64::new(value).unwrap())) } /// Resolve to a decoded string. |
