Skip to content

PdfCraft: An open-source PDF reader and editor written by scratch in pure Rust

Never crash: engine denies the panic lints

Brandon Thomas58cd6614ea02
diff --git a/crates/engine/src/lib.rs b/crates/engine/src/lib.rs
index 2a84de901..89b42d20c 100644
--- a/crates/engine/src/lib.rs
+++ b/crates/engine/src/lib.rs
@@ -10,6 +10,8 @@
//! appended revision — and the view is refreshed from it, so what you see is exactly what Save
//! will write. Saving rebases onto the written bytes, so the next save appends only new edits.
+#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
+
pub mod actions;
pub mod catalog;
pub mod commands;
@@ -1929,7 +1931,8 @@ impl Session {
}
}
}
- Scope::Full => unreachable!("handled above"),
+ // Handled above; kept as a full refresh so the match stays total.
+ Scope::Full => return Self::refresh(doc),
}
doc.info.file_size = bytes.len();
doc.form = form;