diff options
| author | frozolotl <44589151+frozolotl@users.noreply.github.com> | 2024-03-22 13:35:02 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-22 12:35:02 +0000 |
| commit | 0a917aba984a13b50178e1bfcc84c42fa2084814 (patch) | |
| tree | 92579ab651655b4e2ed2e63308faec459337cdfc | |
| parent | 41db766b83bad4c4671423c03c5e54f308032e7b (diff) | |
Fix warnings introduced by rust 1.77 (#3754)
| -rw-r--r-- | crates/typst-cli/src/main.rs | 2 | ||||
| -rw-r--r-- | crates/typst-pdf/src/page.rs | 4 | ||||
| -rw-r--r-- | crates/typst/src/layout/inline/mod.rs | 8 |
3 files changed, 6 insertions, 8 deletions
diff --git a/crates/typst-cli/src/main.rs b/crates/typst-cli/src/main.rs index da0a57fd..c8bd3914 100644 --- a/crates/typst-cli/src/main.rs +++ b/crates/typst-cli/src/main.rs @@ -26,7 +26,7 @@ use crate::timings::Timer; thread_local! { /// The CLI's exit code. - static EXIT: Cell<ExitCode> = Cell::new(ExitCode::SUCCESS); + static EXIT: Cell<ExitCode> = const { Cell::new(ExitCode::SUCCESS) }; } /// The parsed commandline arguments. diff --git a/crates/typst-pdf/src/page.rs b/crates/typst-pdf/src/page.rs index 0342e9fe..590ee905 100644 --- a/crates/typst-pdf/src/page.rs +++ b/crates/typst-pdf/src/page.rs @@ -316,9 +316,7 @@ impl PdfPageLabel { return None; }; - let Some((prefix, kind, case)) = pat.pieces.first() else { - return None; - }; + let (prefix, kind, case) = pat.pieces.first()?; // If there is a suffix, we cannot use the common style optimisation, // since PDF does not provide a suffix field. diff --git a/crates/typst/src/layout/inline/mod.rs b/crates/typst/src/layout/inline/mod.rs index a574cd09..d79dcba4 100644 --- a/crates/typst/src/layout/inline/mod.rs +++ b/crates/typst/src/layout/inline/mod.rs @@ -189,7 +189,7 @@ enum Segment<'a> { /// Horizontal spacing between other segments. Spacing(Spacing), /// A mathematical equation. - Equation(&'a Packed<EquationElem>, Vec<MathParItem>), + Equation(Vec<MathParItem>), /// A box with arbitrary content. Box(&'a Packed<BoxElem>, bool), /// Metadata. @@ -205,7 +205,7 @@ impl Segment<'_> { Self::Box(_, frac) => { (if frac { SPACING_REPLACE } else { OBJ_REPLACE }).len_utf8() } - Self::Equation(_, ref par_items) => { + Self::Equation(ref par_items) => { par_items.iter().map(MathParItem::text).map(char::len_utf8).sum() } Self::Meta => 0, @@ -521,7 +521,7 @@ fn collect<'a>( frame.meta(styles, false); } full.extend(items.iter().map(MathParItem::text)); - Segment::Equation(elem, items) + Segment::Equation(items) } else if let Some(elem) = child.to_packed::<BoxElem>() { let frac = elem.width(styles).is_fractional(); full.push(if frac { SPACING_REPLACE } else { OBJ_REPLACE }); @@ -592,7 +592,7 @@ fn prepare<'a>( items.push(Item::Fractional(v, None)); } }, - Segment::Equation(_, par_items) => { + Segment::Equation(par_items) => { for item in par_items { match item { MathParItem::Space(s) => items.push(Item::Absolute(s)), |
