From 35f44f79de6f0d9c239ad5578fa0e71e9ae11d7e Mon Sep 17 00:00:00 2001 From: Tobias Schmitz Date: Fri, 25 Jul 2025 15:49:16 +0200 Subject: [PATCH] refactor: fix some clippy warnings --- crates/typst-cli/src/compile.rs | 4 +--- crates/typst-pdf/src/tags/list.rs | 6 ++---- crates/typst-pdf/src/tags/mod.rs | 2 +- crates/typst-pdf/src/tags/table.rs | 6 +++--- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/crates/typst-cli/src/compile.rs b/crates/typst-cli/src/compile.rs index 412128018..48e79bc47 100644 --- a/crates/typst-cli/src/compile.rs +++ b/crates/typst-cli/src/compile.rs @@ -131,9 +131,7 @@ impl CompileConfig { PageRanges::new(export_ranges.iter().map(|r| r.0.clone()).collect()) }); - if args.disable_pdf_tags - && args.pdf_standard.iter().any(|s| *s == PdfStandard::Ua_1) - { + if args.disable_pdf_tags && args.pdf_standard.contains(&PdfStandard::Ua_1) { bail!("cannot disable pdf tags when exporting a PDF/UA-1 document"); } diff --git a/crates/typst-pdf/src/tags/list.rs b/crates/typst-pdf/src/tags/list.rs index 8d5a300fc..66d31448d 100644 --- a/crates/typst-pdf/src/tags/list.rs +++ b/crates/typst-pdf/src/tags/list.rs @@ -60,10 +60,8 @@ impl ListCtx { // ``` // // So move the nested list out of the list item. - if let [_, TagNode::Group(tag, _)] = nodes.as_slice() { - if let TagKind::L(_) = tag { - item.sub_list = nodes.pop(); - } + if let [_, TagNode::Group(TagKind::L(_), _)] = nodes.as_slice() { + item.sub_list = nodes.pop(); } item.body = Some(nodes); diff --git a/crates/typst-pdf/src/tags/mod.rs b/crates/typst-pdf/src/tags/mod.rs index 01cdb6ea8..5df67756e 100644 --- a/crates/typst-pdf/src/tags/mod.rs +++ b/crates/typst-pdf/src/tags/mod.rs @@ -895,7 +895,7 @@ impl BBoxCtx { rect.max.y.to_f32(), ) .unwrap(); - Some(BBox::new(page_idx as usize, rect)) + Some(BBox::new(page_idx, rect)) } } diff --git a/crates/typst-pdf/src/tags/table.rs b/crates/typst-pdf/src/tags/table.rs index 697214761..96133b012 100644 --- a/crates/typst-pdf/src/tags/table.rs +++ b/crates/typst-pdf/src/tags/table.rs @@ -211,7 +211,7 @@ impl TableCtx { TableCellKind::Footer => Tag::TFoot.into(), TableCellKind::Data => Tag::TBody.into(), }; - nodes.push(TagNode::Group(tag.into(), std::mem::take(&mut row_chunk))); + nodes.push(TagNode::Group(tag, std::mem::take(&mut row_chunk))); chunk_kind = row_kind; } @@ -224,7 +224,7 @@ impl TableCtx { TableCellKind::Footer => Tag::TFoot.into(), TableCellKind::Data => Tag::TBody.into(), }; - nodes.push(TagNode::Group(tag.into(), row_chunk)); + nodes.push(TagNode::Group(tag, row_chunk)); } let tag = Tag::Table @@ -257,7 +257,7 @@ impl TableCtx { } if let Some((_, cell_id)) = current_header.last() { - if !cell.headers.contains(&cell_id) { + if !cell.headers.contains(cell_id) { cell.headers.push(cell_id.clone()); } }