From f8bbfcbeb19010ee85a26ed2ebc4357d246d9fe6 Mon Sep 17 00:00:00 2001 From: Zhengchao An Date: Fri, 14 Aug 2026 08:14:08 +0800 Subject: [PATCH] chore(ecstore): drop the io_support dead_code blanket (#6082) --- crates/ecstore/src/io_support/mod.rs | 1 - crates/ecstore/src/io_support/rio.rs | 27 ++++++++++++++++----------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/crates/ecstore/src/io_support/mod.rs b/crates/ecstore/src/io_support/mod.rs index ddea43226..040371161 100644 --- a/crates/ecstore/src/io_support/mod.rs +++ b/crates/ecstore/src/io_support/mod.rs @@ -13,7 +13,6 @@ // limitations under the License. // #730: I/O backend selection keeps test-only and staged rio helpers scoped here. -#![allow(dead_code)] pub(crate) mod bitrot; pub(crate) mod compress; diff --git a/crates/ecstore/src/io_support/rio.rs b/crates/ecstore/src/io_support/rio.rs index e62d1d1e3..138a4be53 100644 --- a/crates/ecstore/src/io_support/rio.rs +++ b/crates/ecstore/src/io_support/rio.rs @@ -25,9 +25,20 @@ use tokio::io::AsyncRead; #[cfg(feature = "rio-v2")] const MINIO_S2_COMPRESSION_SCHEME: &str = "klauspost/compress/s2"; +// The S2 padding multiple rio-v2 pads compressed streams to before +// encryption. Only the padding test asserts it today, so the lib target sees +// it as unused (backlog#1823). #[cfg(feature = "rio-v2")] +#[allow(dead_code, reason = "on-disk contract asserted by the rio-v2 padding test (backlog#1823)")] const ENCRYPTED_S2_PADDING_MULTIPLE: usize = 256; +/// Which rio implementation this build compiled in. Only the feature-seam +/// guard test in lib.rs reads it, so the lib target sees it as unused +/// (backlog#1823). +#[allow( + dead_code, + reason = "asserted by the rio backend feature-seam test in lib.rs (backlog#1823)" +)] pub const fn backend_name() -> &'static str { #[cfg(feature = "rio-v2")] { @@ -53,17 +64,6 @@ pub fn compression_metadata_value(algorithm: CompressionAlgorithm) -> String { } } -pub fn compression_scheme_to_algorithm(scheme: &str) -> std::io::Result { - #[cfg(feature = "rio-v2")] - if scheme.eq_ignore_ascii_case(MINIO_S2_COMPRESSION_SCHEME) { - // rio_v2 currently routes all compressed-object handling through the S2 - // reader implementation, so the enum is only a placeholder token here. - return Ok(CompressionAlgorithm::default()); - } - - CompressionAlgorithm::from_str(scheme) -} - #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum ReadCompressionBackend { Legacy, @@ -82,6 +82,11 @@ pub fn compression_scheme_to_read_plan(scheme: &str) -> std::io::Result<(Compres #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum ReadEncryptionBackend { Legacy, + // Never constructed today — every read still selects Legacy — but the + // decrypt paths below carry live match arms for it. This is the rio-v2 + // read seam (backlog#1638 / #1835), not dead code: deleting the variant + // would delete those arms with it. + #[allow(dead_code, reason = "rio-v2 read seam; match arms below are live (backlog#1823)")] V2, }