From f1f910277cefb079ccd082aaa07b45a3b83b4a7c Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 19 Oct 2026 01:30:14 +0000 Subject: [PATCH] Fix the manual_map lint in TrustedLenAdapter::next With debug assertions compiled out, matching on the inner iterator's next item is a manual Option::map, which clippy rejects in release builds. Take the item first and check it under debug_assertions instead. Signed-off-by: Robert Kruszewski Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011JxDQs8L3TZ6VhZV9Bt6cr --- vortex-buffer/src/trusted_len.rs | 36 +++++++++++++------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/vortex-buffer/src/trusted_len.rs b/vortex-buffer/src/trusted_len.rs index fcd2fc59e6b..433c85f428d 100644 --- a/vortex-buffer/src/trusted_len.rs +++ b/vortex-buffer/src/trusted_len.rs @@ -30,29 +30,23 @@ impl Iterator for TrustedLenAdapter { #[inline] fn next(&mut self) -> Option { - match self.inner.next() { - None => { - #[cfg(debug_assertions)] - { - assert_eq!( - self.len, self.count, - "TrustedLenAdapter: iterator ended early" - ); - } - None - } - Some(item) => { - #[cfg(debug_assertions)] - { - self.count += 1; - assert!( - self.count <= self.len, - "TrustedLenAdapter: iterator yielded more items than promised" - ); - } - Some(item) + let item = self.inner.next(); + #[cfg(debug_assertions)] + { + if item.is_some() { + self.count += 1; + assert!( + self.count <= self.len, + "TrustedLenAdapter: iterator yielded more items than promised" + ); + } else { + assert_eq!( + self.len, self.count, + "TrustedLenAdapter: iterator ended early" + ); } } + item } #[inline]