PdfCraft: An open-source PDF reader and editor written by scratch in pure Rust
Never crash: deny the panic lints in crates that are already clean
Brandon Thomas1434db626afd
diff --git a/crates/annot/src/lib.rs b/crates/annot/src/lib.rsindex f49655f64..6a7d88124 100644--- a/crates/annot/src/lib.rs+++ b/crates/annot/src/lib.rs@@ -12,6 +12,8 @@//! Every edit mutates a `printcraft_cos::Document` (copy-on-write); callers snapshot it first//! for undo. Keys we do not understand are left alone.+#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]+use printcraft_cos::{Dict, Document, ObjRef, Object, PdfString};pub mod appearance;diff --git a/crates/compare/src/lib.rs b/crates/compare/src/lib.rsindex 5141f93f1..31e661c51 100644--- a/crates/compare/src/lib.rs+++ b/crates/compare/src/lib.rs@@ -5,6 +5,8 @@//! grouped into [`Change`]s — inserted, deleted or replaced runs of words — each with the//! rectangles to highlight on the old and new pages.+#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]+/// A word of one document.#[derive(Clone, Debug, PartialEq)]pub struct Word {diff --git a/crates/content/src/lib.rs b/crates/content/src/lib.rsindex 0f0489b4d..c541d7019 100644--- a/crates/content/src/lib.rs+++ b/crates/content/src/lib.rs@@ -5,6 +5,8 @@//! [`Parsed::skipped`]) instead of failing the whole stream, and it never panics. Inline images//! (`BI … ID … EI`) are kept whole, so a parse → serialize round trip preserves them.+#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]+use printcraft_cos::{Dict, Lexer, Object, PdfString, serialize};#[cfg(test)]diff --git a/crates/cos/src/lib.rs b/crates/cos/src/lib.rsindex 45409b4da..ad85c4f83 100644--- a/crates/cos/src/lib.rs+++ b/crates/cos/src/lib.rs@@ -9,6 +9,8 @@//! incremental and full writing. Not yet: encryption (M1.6), object-stream / xref-stream output//! for full saves, linearization (M11).+#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]+mod document;mod object;mod parser;diff --git a/crates/export/src/lib.rs b/crates/export/src/lib.rsindex c7a12022d..a45bec496 100644--- a/crates/export/src/lib.rs+++ b/crates/export/src/lib.rs@@ -5,6 +5,8 @@//! document: headings are the paragraphs set larger than the body text, and images sit where//! they fall between paragraphs.+#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]+mod zip;pub use zip::Zip;diff --git a/crates/geom/src/lib.rs b/crates/geom/src/lib.rsindex 75ff3a428..eaa109c6b 100644--- a/crates/geom/src/lib.rs+++ b/crates/geom/src/lib.rs@@ -3,6 +3,8 @@//! PDF user space is y-up with the origin at the bottom-left of the page; view space is y-down.//! `PageRect` is always in PDF user space (points, 1/72 inch).+#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]+/// An axis-aligned rectangle in PDF user space (points).#[derive(Clone, Copy, Debug, PartialEq, Default)]pub struct PageRect {diff --git a/crates/model/src/lib.rs b/crates/model/src/lib.rsindex d28f0d4ec..9d2c9febc 100644--- a/crates/model/src/lib.rs+++ b/crates/model/src/lib.rs@@ -1,5 +1,7 @@//! printcraft-model — typed views over the PDF object graph (L2). See the README.+#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]+use printcraft_cos::{Dict, Document, ObjRef, Object};/// Attributes a page inherits from its ancestors (ISO 32000-2 §7.7.3.4).diff --git a/crates/ocr/src/lib.rs b/crates/ocr/src/lib.rsindex 755fc3e4f..026dda978 100644--- a/crates/ocr/src/lib.rs+++ b/crates/ocr/src/lib.rs@@ -8,6 +8,8 @@//!//! The models read the Latin alphabet (English and other languages written without accents).+#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]+use std::path::{Path, PathBuf};pub use printcraft_fonts::helvetica_width;diff --git a/crates/preflight/src/lib.rs b/crates/preflight/src/lib.rsindex a0cfe2b29..beb78dc35 100644--- a/crates/preflight/src/lib.rs+++ b/crates/preflight/src/lib.rs@@ -19,6 +19,8 @@//! intent, forbidden actions, annotation flags, Interpolate, NeedAppearances, encryption) and//! returns what remains. Fonts that aren't embedded can't be fixed here.+#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]+pub mod icc;mod xmp;diff --git a/crates/print/src/lib.rs b/crates/print/src/lib.rsindex ad94ea090..a0ef79890 100644--- a/crates/print/src/lib.rs+++ b/crates/print/src/lib.rs@@ -15,6 +15,8 @@//! The sheets are written as a new, unencrypted, garbage-collected PDF; [`spool`] hands it to//! the system's print spooler (CUPS on macOS and Linux).+#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]+use printcraft_content::Matrix;use printcraft_cos::{Dict, Document, ObjRef, Object, SaveOptions, Stream, write_full};diff --git a/crates/redact/src/lib.rs b/crates/redact/src/lib.rsindex dd310a888..57189ade4 100644--- a/crates/redact/src/lib.rs+++ b/crates/redact/src/lib.rs@@ -12,6 +12,8 @@//! A verification pass then re-reads every redacted page; if any glyph or inline image is still//! under a region the whole operation fails (callers keep the previous document: fail-closed).+#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]+use printcraft_cos::{Dict, Document, ObjRef, Object, Stream};mod image;