diff --git a/crates/core/src/facade.rs b/crates/core/src/facade.rs index 3317a9bf..f0c69970 100644 --- a/crates/core/src/facade.rs +++ b/crates/core/src/facade.rs @@ -82,6 +82,7 @@ pub fn import_pdf(sheet: &LoadedSheet, bytes: &[u8]) -> String { /// BOM dropped, then `draft.restore` with no archive, including its OD-3 value budget. The /// kinds are `draft.restore`'s; a text that is not UTF-8 is `invalid`, as the application /// already called it (`error_invalid_copy`). Takes the bytes by value: the copy lives once. +#[cfg(feature = "pdf-read")] pub fn restore_copy(sheet: &LoadedSheet, bytes: Vec) -> String { use crate::domain::session::restore_draft; use crate::ops::{over_value_budget, restore_failure}; diff --git a/crates/core/tests/common/r4.rs b/crates/core/tests/common/r4.rs index ddcdb2dc..6a67a517 100644 --- a/crates/core/tests/common/r4.rs +++ b/crates/core/tests/common/r4.rs @@ -98,11 +98,13 @@ pub fn latin1_bytes(text: &str) -> Vec { /// An [`ImageSink`] for the layout oracles: keeps every PNG given, sized from its header, /// so the O1 `pngSha256` per embed index can be checked without a PDF writer. +#[cfg(feature = "pdf-write")] #[derive(Default)] pub struct PngKeeper { pub pngs: Vec>, } +#[cfg(feature = "pdf-write")] impl faunosteo_core::pdf::write::layout::ImageSink for PngKeeper { fn embed(&mut self, png: &[u8]) -> Option { let (width, height) = faunosteo_core::pdf::write::layout::png::dimensions(png)?; diff --git a/scripts/rust-check.sh b/scripts/rust-check.sh index 316b7d9f..ccd3a599 100755 --- a/scripts/rust-check.sh +++ b/scripts/rust-check.sh @@ -15,6 +15,10 @@ cd "$(dirname "$0")/.." cargo fmt --all --check cargo clippy --workspace --all-targets --locked -- -D warnings cargo test --workspace --locked +# The core alone with no feature (what the worker-side and any future consumer build): the +# workspace run above unifies the wasm crate's features, so a code path that needs +# `pdf-read` or `pdf-write` without its gate compiles there and nowhere else. +cargo clippy -p faunosteo-core --all-targets --locked -- -D warnings # The PDF reader and writer (R4) are feature-gated in the core: their code and suites compile # only here and in the wasm module, never in the worker; `cli` adds the archive check tool # (`report-compare`, R4.7) and its O10 suite, never built into the module.