diff --git a/crates/a11y/src/content.rs b/crates/a11y/src/content.rs index 550cb299f..d548c57f9 100644 --- a/crates/a11y/src/content.rs +++ b/crates/a11y/src/content.rs @@ -57,9 +57,7 @@ fn bdc_marks(doc: &Document, op: &pdfcraft_content::Op, props: &Dict) -> bool { op.name(0) == Some(b"Artifact") || match op.operands.get(1) { Some(Object::Dict(d)) => d.contains(b"MCID"), - Some(Object::Name(n)) => { - props.get(n).map(|x| doc.resolve(x)).and_then(|x| x.as_dict().map(|d| d.contains(b"MCID"))).unwrap_or(false) - } + Some(Object::Name(n)) => props.get(n).map(|x| doc.resolve(x)).and_then(|x| x.as_dict().map(|d| d.contains(b"MCID"))).unwrap_or(false), _ => false, } } diff --git a/crates/edit/src/added/arabic_tests.rs b/crates/edit/src/added/arabic_tests.rs index 1dbc407f5..3c97e2d65 100644 --- a/crates/edit/src/added/arabic_tests.rs +++ b/crates/edit/src/added/arabic_tests.rs @@ -6,8 +6,8 @@ use std::cell::Cell; use pdfcraft_cos::{Dict, Document, ObjRef, Object, PdfString}; +use super::{AddedText, GLYPHS_PER_FONT, GlyphError, GlyphOutline, LaidLine, Piece, ShapedCluster, ShapedScript, draw_laid_shaped}; use crate::EditError; -use super::{draw_laid_shaped, AddedText, GlyphError, GlyphOutline, LaidLine, Piece, ShapedCluster, ShapedScript, GLYPHS_PER_FONT}; /// Regression fingerprint for the small-item fixture: drawing bytes, font map and document /// objects, with generated streams decoded so Flate backend selection cannot change the hash. diff --git a/crates/edit/src/marked_isolation_tests.rs b/crates/edit/src/marked_isolation_tests.rs index 42647c17d..daa8ef5aa 100644 --- a/crates/edit/src/marked_isolation_tests.rs +++ b/crates/edit/src/marked_isolation_tests.rs @@ -1,9 +1,8 @@ use pdfcraft_cos::{Dict, Document, Object, Stream}; use super::{ - added, add_header_footer, add_watermark, contents, is_wrap_close, page_list, place_tagged, remove_marks, - stamp, stream_bytes, stream_tag, wrapper_role, Context, EditError, HeaderFooter, MarkKind, Watermark, - ISOLATION_MAX_DEPTH, OLD_WRAP_CLOSE, WRAP_CLOSE, WRAP_OPEN, + Context, EditError, HeaderFooter, ISOLATION_MAX_DEPTH, MarkKind, OLD_WRAP_CLOSE, WRAP_CLOSE, WRAP_OPEN, Watermark, add_header_footer, + add_watermark, added, contents, is_wrap_close, page_list, place_tagged, remove_marks, stamp, stream_bytes, stream_tag, wrapper_role, }; fn fixture(parts: &[&[u8]]) -> Document { diff --git a/crates/edit/src/text_regions.rs b/crates/edit/src/text_regions.rs index 69fecf068..f64c2240c 100644 --- a/crates/edit/src/text_regions.rs +++ b/crates/edit/src/text_regions.rs @@ -5,10 +5,9 @@ use std::collections::HashMap; use pdfcraft_cos::{Dict, Document, Object, PdfString}; use super::{ - coincident_ops, content_streams, needs_type3, no_japanese_font, page_dict, reveal_ops, rewritten_contents, - source_encodes, source_family, source_program, source_show, source_space, source_width, splice, type3_font, - union, BlockStyle, EditError, LineEdit, Matrix, Metrics, Op, Pieces, RangeStyle, TextBlock, TextLine, - MAX_TYPE3_GLYPHS, + BlockStyle, EditError, LineEdit, MAX_TYPE3_GLYPHS, Matrix, Metrics, Op, Pieces, RangeStyle, TextBlock, TextLine, coincident_ops, content_streams, + needs_type3, no_japanese_font, page_dict, reveal_ops, rewritten_contents, source_encodes, source_family, source_program, source_show, + source_space, source_width, splice, type3_font, union, }; fn same_plane(a: &TextLine, b: &TextLine) -> bool { diff --git a/crates/edit/src/text_session.rs b/crates/edit/src/text_session.rs index f46847723..fe1aa7868 100644 --- a/crates/edit/src/text_session.rs +++ b/crates/edit/src/text_session.rs @@ -4,8 +4,8 @@ //! that document has changed since. use super::{ - group_blocks, layout_draft, rewrite_block_from, text_lines, BlockStyle, Document, EditError, LineEdit, - TextBlock, TextEditLayout, TextLine, MAX_TYPE3_GLYPHS, + BlockStyle, Document, EditError, LineEdit, MAX_TYPE3_GLYPHS, TextBlock, TextEditLayout, TextLine, group_blocks, layout_draft, rewrite_block_from, + text_lines, }; /// One paragraph being edited: the document as it was opened, and the page's lines then. diff --git a/crates/sign/src/pdf_discovery_tests.rs b/crates/sign/src/pdf_discovery_tests.rs index 0accc84cc..f2797e1a0 100644 --- a/crates/sign/src/pdf_discovery_tests.rs +++ b/crates/sign/src/pdf_discovery_tests.rs @@ -4,8 +4,7 @@ use std::sync::atomic::Ordering; use pdfcraft_cos::{Algorithm, Dict, Document, NewEncryption, ObjRef, Object, SaveOptions, Stream, XrefEntry, write_full, write_incremental}; use super::{ - is_document_timestamp, list_cached, only_grew, DigestCache, DssEvidence, TrustStore, DISCOVERY_CACHE_LIMIT, - MAX_DSS_BYTES, MAX_DSS_ENTRIES, + DISCOVERY_CACHE_LIMIT, DigestCache, DssEvidence, MAX_DSS_BYTES, MAX_DSS_ENTRIES, TrustStore, is_document_timestamp, list_cached, only_grew, }; const STAMP: &str = "<< /Type /Sig /SubFilter /ETSI.RFC3161 /ByteRange [0 1 2 1] >>"; diff --git a/crates/ui-egui/tests/it/recovery.rs b/crates/ui-egui/tests/it/recovery.rs index 1dd24bd7c..3e3f3a593 100644 --- a/crates/ui-egui/tests/it/recovery.rs +++ b/crates/ui-egui/tests/it/recovery.rs @@ -43,7 +43,9 @@ fn store(tag: &str) -> RecoveryStore { /// Snapshot files (the PDF and its sidecar), not the running instances' lock files. fn files_in(s: &RecoveryStore) -> usize { - std::fs::read_dir(s.dir()).map(|d| d.flatten().filter(|e| e.path().extension().and_then(std::ffi::OsStr::to_str) != Some("lock")).count()).unwrap_or(0) + std::fs::read_dir(s.dir()) + .map(|d| d.flatten().filter(|e| e.path().extension().and_then(std::ffi::OsStr::to_str) != Some("lock")).count()) + .unwrap_or(0) } /// A session that edits a document, autosaves, and then "crashes" (is dropped). diff --git a/crates/xfa/src/data.rs b/crates/xfa/src/data.rs index d6bdd6b78..2241e959c 100644 --- a/crates/xfa/src/data.rs +++ b/crates/xfa/src/data.rs @@ -441,11 +441,8 @@ pub fn pattern_to_iso(text: &str, pattern: &str) -> Option { "yyyy" | "yy" | "mm" | "m" | "dd" | "d" => { // Digits up to the next literal (or a fixed width). let fixed = matches!(t.as_str(), "yyyy" | "yy" | "mm" | "dd"); - let width = if fixed { - t.len() - } else { - rest.chars().take_while(char::is_ascii_digit).count().min(if t == "d" || t == "m" { 2 } else { 4 }) - }; + let width = + if fixed { t.len() } else { rest.chars().take_while(char::is_ascii_digit).count().min(if t == "d" || t == "m" { 2 } else { 4 }) }; let digits: String = rest.chars().take(width).collect(); if digits.is_empty() || !digits.chars().all(char::is_ascii_digit) { return None; diff --git a/crates/xfa/src/layout.rs b/crates/xfa/src/layout.rs index 0a4d1b0dd..7ba1143b3 100644 --- a/crates/xfa/src/layout.rs +++ b/crates/xfa/src/layout.rs @@ -15,8 +15,8 @@ use base64::Engine; use crate::XfaError; use crate::data::{DataNode, data_date_letters, data_path, data_to_iso, date_letters, is_on, iso_to_pattern}; use crate::model::{ - Access, Area, Border, ChoiceList, Common, Draw, ExclGroup, Field, Font, HAlign, Layout, Margin, Node, Occur, - PageArea, PageRole, Para, Placement, Presence, Rect, Script, Stroke, Subform, Template, Ui, VAlign, Value, + Access, Area, Border, ChoiceList, Common, Draw, ExclGroup, Field, Font, HAlign, Layout, Margin, Node, Occur, PageArea, PageRole, Para, Placement, + Presence, Rect, Script, Stroke, Subform, Template, Ui, VAlign, Value, }; use crate::text::{self, Block, Face, Span}; diff --git a/crates/xfa/src/parse.rs b/crates/xfa/src/parse.rs index 7a661e80c..ea2bd614f 100644 --- a/crates/xfa/src/parse.rs +++ b/crates/xfa/src/parse.rs @@ -6,9 +6,8 @@ use roxmltree::Node as XmlNode; use crate::XfaError; use crate::model::{ - Access, Anchor, Area, Border, Caption, ChoiceList, Color, Common, Draw, Edge, ExclGroup, Field, FontSpec, - HAlign, Layout, Margin, Node, Occur, PageArea, PageRole, PageSet, ParaSpec, Paragraph, Placement, Presence, - Rect, RichText, Run, Script, Stroke, Subform, Template, Ui, VAlign, Value, + Access, Anchor, Area, Border, Caption, ChoiceList, Color, Common, Draw, Edge, ExclGroup, Field, FontSpec, HAlign, Layout, Margin, Node, Occur, + PageArea, PageRole, PageSet, ParaSpec, Paragraph, Placement, Presence, Rect, RichText, Run, Script, Stroke, Subform, Template, Ui, VAlign, Value, }; /// Deepest element nesting followed (templates are shallow; hostile ones are not).