PdfCraft: An open-source PDF reader and editor written by scratch in pure Rust
Refactor render for strict Clippy checks
Dylan M. Taylora11909551d50
diff --git a/crates/render/src/inspect/annotations.rs b/crates/render/src/inspect/annotations.rsindex 07283c047..603aa8811 100644--- a/crates/render/src/inspect/annotations.rs+++ b/crates/render/src/inspect/annotations.rs@@ -1,7 +1,7 @@use super::core::{limited_pdf_string, pretty_date, spend};use super::model::{Annotation, AttachmentSource, DestView, Field, FieldKind, LayerOp, Link, LinkTarget, RemoteDestination, link_replies};use super::navigation::text_string;-use super::*;+use super::{Dictionary, DocInfo, Entry, HashMap, HashSet, Inspector, Object, ObjectId};/// At most this many `/State` entries of a set-layer-visibility action are read.const MAX_LAYER_STATE: usize = 1024;diff --git a/crates/render/src/inspect/core.rs b/crates/render/src/inspect/core.rsindex 875d87365..c190dc565 100644--- a/crates/render/src/inspect/core.rs+++ b/crates/render/src/inspect/core.rs@@ -1,7 +1,10 @@use super::annotations::MAX_LINK_ATTACHMENT_TEXT_BYTES;use super::model::{AttachmentSource, PageInfo, Xfa};use super::navigation::text_string;-use super::*;+use super::{+ Arc, AssertUnwindSafe, DecryptionError, Dictionary, DocInfo, Document, HashMap, HashSet, LazyStructure, LoadOptions, LoadPdfError, Object,+ ObjectId, OnceCell, OpenError, Pdf, Structure, catch_unwind,+};/// lopdf decodes object and cross-reference streams while it loads, with no limit unless one is/// set: a few hundred bytes of nested FlateDecode then inflate to gigabytes. Real object anddiff --git a/crates/render/src/inspect/model.rs b/crates/render/src/inspect/model.rsindex e5f09c924..490897b60 100644--- a/crates/render/src/inspect/model.rs+++ b/crates/render/src/inspect/model.rs@@ -1,4 +1,4 @@-use super::*;+use super::HashMap;/// What kind of XFA form a document has (`/AcroForm /XFA`).#[derive(Clone, Copy, Debug, PartialEq, Eq)]diff --git a/crates/render/src/inspect/navigation.rs b/crates/render/src/inspect/navigation.rsindex 173217c93..4000a7413 100644--- a/crates/render/src/inspect/navigation.rs+++ b/crates/render/src/inspect/navigation.rs@@ -2,7 +2,10 @@use super::core::inspect;use super::core::spend;use super::model::{DestView, OutlineItem, PageInfo};-use super::*;+use super::{+ BTreeMap, Dictionary, HashMap, HashSet, Inspector, MAX_LABEL_BYTES, MAX_LABEL_TOTAL_BYTES, MAX_LABEL_TREE_DEPTH, MAX_LABEL_TREE_WORK,+ MAX_PREFIX_BYTES, MAX_PREFIX_TOTAL_BYTES, Object, ObjectId, alpha, roman,+};/// `DocInfo::outline` holds the first this many bookmarks in outline order. Opening a document/// reads only this window; the rest are listed by page through `pdfcraft_organize`.diff --git a/crates/render/src/inspect/resources.rs b/crates/render/src/inspect/resources.rsindex 0386c5781..0895c64f8 100644--- a/crates/render/src/inspect/resources.rs+++ b/crates/render/src/inspect/resources.rs@@ -3,7 +3,7 @@ use super::core::inspect;use super::core::{Inspector, load_options};use super::model::{Attachment, AttachmentSource, FontInfo, Layer, PageTransition, TransitionStyle};use super::navigation::NameTreeSeen;-use super::*;+use super::{AssertUnwindSafe, Dictionary, DocInfo, Document, HashSet, Object, ObjectId, catch_unwind};/// Decoded bytes read from an XFA form's configuration packet (or a whole-XDP `/XFA` stream) to/// find `dynamicRender`. Designer's packets are a few kilobytes; a whole XDP can hold the template.diff --git a/crates/render/src/raster/pool.rs b/crates/render/src/raster/pool.rsindex 81447263d..66a575eae 100644--- a/crates/render/src/raster/pool.rs+++ b/crates/render/src/raster/pool.rs@@ -1,4 +1,8 @@-use super::*;+use super::{+ Arc, AssertUnwindSafe, AtomicBool, AtomicRenderStats, InterpreterSettings, JoinHandle, Mutex, Ordering, PageRenderer, Pdf, Pixels, Receiver,+ RenderCache, RenderConfig, RenderRequest, RenderStats, RenderedPage, RequestFailureKey, RequestKind, ResultReceiver, Stopwatch, SyncSender,+ WorkQueue, catch_unwind, finish, panic_message, parse, render_page, sync_channel, take_warnings, warning_settings,+};/// How long one page may render before the pool gives up on it (the watchdog).pub const STUCK_AFTER: std::time::Duration = std::time::Duration::from_secs(20);diff --git a/crates/render/src/text/device.rs b/crates/render/src/text/device.rsindex eba4d9c1c..79bf05f7d 100644--- a/crates/render/src/text/device.rs+++ b/crates/render/src/text/device.rs@@ -1,5 +1,8 @@use super::layout::{Flow, along_baseline, arrange_flow, compatible, continues, from_upright, to_upright, unrolled};-use super::*;+use super::{+ Affine, BezPath, BlendMode, ClipPath, Context, Device, Glyph, GlyphDrawMode, HashMap, Image, InterpreterCache, InterpreterSettings, PageText,+ Paint, PathDrawMode, Pdf, Rect, Shape, SoftMask, TextFilter, TextGlyph, TransformExt, interpret_page,+};/// Largest sine of the angle between a glyph's writing direction and a flow's for the glyph to be/// laid out in that flow's frame. Turning an em box by θ moves its edges along the line by up todiff --git a/crates/render/src/text/layout.rs b/crates/render/src/text/layout.rsindex 302184aeb..00b45e266 100644--- a/crates/render/src/text/layout.rs+++ b/crates/render/src/text/layout.rs@@ -1,6 +1,6 @@use super::device::{DIRECTION_TOLERANCE, Drawn, WORD_GAP};use super::order::{NONE, REDRAW_CANDIDATES, Run, Scratch, Seg, fingerprint, place_glyphs, redraws, restarts_run, reverse_rtl};-use super::*;+use super::{HashMap, PageText, TextGlyph};/// Glyphs in reading order, as indices into the page's glyphs, with their lines and word gaps.pub(super) struct Flow {diff --git a/crates/render/src/text/order.rs b/crates/render/src/text/order.rsindex 6892d3f2a..d8cb65f32 100644--- a/crates/render/src/text/order.rs+++ b/crates/render/src/text/order.rs@@ -1,5 +1,5 @@+use super::TextGlyph;use super::layout::{is_rtl, union};-use super::*;/// Glyphs `start..end` of the glyph list [`arrange`] lays out, drawn one after another.#[derive(Clone, Copy, Debug, PartialEq, Eq)]