Fix warnings introduced by rust 1.77 (#3754)

This commit is contained in:
frozolotl 2024-03-22 13:35:02 +01:00 committed by GitHub
parent 41db766b83
commit 0a917aba98
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 8 deletions

View File

@ -26,7 +26,7 @@ use crate::timings::Timer;
thread_local! { thread_local! {
/// The CLI's exit code. /// 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. /// The parsed commandline arguments.

View File

@ -316,9 +316,7 @@ impl PdfPageLabel {
return None; return None;
}; };
let Some((prefix, kind, case)) = pat.pieces.first() else { let (prefix, kind, case) = pat.pieces.first()?;
return None;
};
// If there is a suffix, we cannot use the common style optimisation, // If there is a suffix, we cannot use the common style optimisation,
// since PDF does not provide a suffix field. // since PDF does not provide a suffix field.

View File

@ -189,7 +189,7 @@ enum Segment<'a> {
/// Horizontal spacing between other segments. /// Horizontal spacing between other segments.
Spacing(Spacing), Spacing(Spacing),
/// A mathematical equation. /// A mathematical equation.
Equation(&'a Packed<EquationElem>, Vec<MathParItem>), Equation(Vec<MathParItem>),
/// A box with arbitrary content. /// A box with arbitrary content.
Box(&'a Packed<BoxElem>, bool), Box(&'a Packed<BoxElem>, bool),
/// Metadata. /// Metadata.
@ -205,7 +205,7 @@ impl Segment<'_> {
Self::Box(_, frac) => { Self::Box(_, frac) => {
(if frac { SPACING_REPLACE } else { OBJ_REPLACE }).len_utf8() (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() par_items.iter().map(MathParItem::text).map(char::len_utf8).sum()
} }
Self::Meta => 0, Self::Meta => 0,
@ -521,7 +521,7 @@ fn collect<'a>(
frame.meta(styles, false); frame.meta(styles, false);
} }
full.extend(items.iter().map(MathParItem::text)); full.extend(items.iter().map(MathParItem::text));
Segment::Equation(elem, items) Segment::Equation(items)
} else if let Some(elem) = child.to_packed::<BoxElem>() { } else if let Some(elem) = child.to_packed::<BoxElem>() {
let frac = elem.width(styles).is_fractional(); let frac = elem.width(styles).is_fractional();
full.push(if frac { SPACING_REPLACE } else { OBJ_REPLACE }); full.push(if frac { SPACING_REPLACE } else { OBJ_REPLACE });
@ -592,7 +592,7 @@ fn prepare<'a>(
items.push(Item::Fractional(v, None)); items.push(Item::Fractional(v, None));
} }
}, },
Segment::Equation(_, par_items) => { Segment::Equation(par_items) => {
for item in par_items { for item in par_items {
match item { match item {
MathParItem::Space(s) => items.push(Item::Absolute(s)), MathParItem::Space(s) => items.push(Item::Absolute(s)),