From deea28598149ac786d833c710e3ca8c76d431bbb Mon Sep 17 00:00:00 2001 From: Jakob Date: Sat, 10 Oct 2026 14:46:44 +0200 Subject: [PATCH] Gate the _check-cache verification with #[cfg] instead of cfg!() The cfg!() check is a runtime-false condition, so the await inside it still adds a suspend state to get_page_state_cached's state machine, which the optimizer cannot remove. The verification code was compiled into every build. Measured -272 bytes of .text on a thumbv7em firmware. --- src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 37fb23a..7584519 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -172,7 +172,8 @@ impl, KEY> GenericStorage { page_index: usize, ) -> Result> { if let Some(cached_page_state) = self.cache.get_page_state(page_index) { - if cfg!(feature = "_check-cache") { + #[cfg(feature = "_check-cache")] + { let discovered_state = self.get_page_state(page_index).await?; assert_eq!( cached_page_state, discovered_state,