calm down clippy even more (#1997)

This commit is contained in:
Beiri22 2023-08-25 14:27:50 +02:00 committed by GitHub
parent 94df32a919
commit ea469c2df6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 22 additions and 26 deletions

View File

@ -172,7 +172,9 @@ impl<'a> Handler<'a> {
md::Event::Html(html) if html.starts_with("<contributors") => { md::Event::Html(html) if html.starts_with("<contributors") => {
let from = html_attr(html, "from").unwrap(); let from = html_attr(html, "from").unwrap();
let to = html_attr(html, "to").unwrap(); let to = html_attr(html, "to").unwrap();
let Some(output) = contributors(self.resolver, from, to) else { return false }; let Some(output) = contributors(self.resolver, from, to) else {
return false;
};
*html = output.raw.into(); *html = output.raw.into();
} }

View File

@ -859,7 +859,7 @@ fn minmax(
goal: Ordering, goal: Ordering,
) -> SourceResult<Value> { ) -> SourceResult<Value> {
let mut iter = values.into_iter(); let mut iter = values.into_iter();
let Some(Spanned { v: mut extremum, ..}) = iter.next() else { let Some(Spanned { v: mut extremum, .. }) = iter.next() else {
bail!(span, "expected at least one value"); bail!(span, "expected at least one value");
}; };

View File

@ -229,9 +229,7 @@ impl Layout for TableElem {
/// and after the extents, e.g. [10mm, 5mm] -> [0mm, 10mm, 15mm]. /// and after the extents, e.g. [10mm, 5mm] -> [0mm, 10mm, 15mm].
fn points(extents: impl IntoIterator<Item = Abs>) -> impl Iterator<Item = Abs> { fn points(extents: impl IntoIterator<Item = Abs>) -> impl Iterator<Item = Abs> {
let mut offset = Abs::zero(); let mut offset = Abs::zero();
std::iter::once(Abs::zero()) std::iter::once(Abs::zero()).chain(extents).map(move |extent| {
.chain(extents.into_iter())
.map(move |extent| {
offset += extent; offset += extent;
offset offset
}) })

View File

@ -249,14 +249,12 @@ impl Layout for EquationElem {
// Find a math font. // Find a math font.
let variant = variant(styles); let variant = variant(styles);
let world = vt.world; let world = vt.world;
let Some(font) = families(styles) let Some(font) = families(styles).find_map(|family| {
.find_map(|family| {
let id = world.book().select(family.as_str(), variant)?; let id = world.book().select(family.as_str(), variant)?;
let font = world.font(id)?; let font = world.font(id)?;
let _ = font.ttf().tables().math?.constants?; let _ = font.ttf().tables().math?.constants?;
Some(font) Some(font)
}) }) else {
else {
bail!(self.span(), "current font does not support math"); bail!(self.span(), "current font does not support math");
}; };

View File

@ -214,7 +214,8 @@ impl Show for OutlineElem {
self.span(), self.span(),
elem.clone().into_inner(), elem.clone().into_inner(),
self.fill(styles), self.fill(styles),
)? else { )?
else {
continue; continue;
}; };

View File

@ -515,8 +515,7 @@ fn parse_theme(
vm: &mut Vm, vm: &mut Vm,
args: &mut Args, args: &mut Args,
) -> SourceResult<(Option<EcoString>, Option<Bytes>)> { ) -> SourceResult<(Option<EcoString>, Option<Bytes>)> {
let Some(Spanned { v: path, span }) = let Some(Spanned { v: path, span }) = args.named::<Spanned<EcoString>>("theme")?
args.named::<Spanned<EcoString>>("theme")?
else { else {
return Ok((None, None)); return Ok((None, None));
}; };

View File

@ -53,11 +53,9 @@ fn prepare(stream: TokenStream, item: &syn::ItemFn) -> Result<Func> {
}; };
let syn::Pat::Ident(syn::PatIdent { let syn::Pat::Ident(syn::PatIdent {
by_ref: None, by_ref: None, mutability: None, ident, ..
mutability: None, }) = &*typed.pat
ident, else {
..
}) = &*typed.pat else {
bail!(typed.pat, "expected identifier"); bail!(typed.pat, "expected identifier");
}; };