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-syntax/src | |
| parent | a18ca3481da17a4de1cc7f9890f0c61efb480655 (diff) | |
Table multiple headers and subheaders (#6168)
Diffstat (limited to 'crates/typst-syntax/src')
| -rw-r--r-- | crates/typst-syntax/src/span.rs | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/crates/typst-syntax/src/span.rs b/crates/typst-syntax/src/span.rs index 3618b8f2..b383ec27 100644 --- a/crates/typst-syntax/src/span.rs +++ b/crates/typst-syntax/src/span.rs @@ -71,10 +71,7 @@ impl Span { /// Create a span that does not point into any file. pub const fn detached() -> Self { - match NonZeroU64::new(Self::DETACHED) { - Some(v) => Self(v), - None => unreachable!(), - } + Self(NonZeroU64::new(Self::DETACHED).unwrap()) } /// Create a new span from a file id and a number. @@ -111,11 +108,9 @@ impl Span { /// Pack a file ID and the low bits into a span. const fn pack(id: FileId, low: u64) -> Self { let bits = ((id.into_raw().get() as u64) << Self::FILE_ID_SHIFT) | low; - match NonZeroU64::new(bits) { - Some(v) => Self(v), - // The file ID is non-zero. - None => unreachable!(), - } + + // The file ID is non-zero. + Self(NonZeroU64::new(bits).unwrap()) } /// Whether the span is detached. |
