Skip to content

Fix the manual_map lint in TrustedLenAdapter::next - #10597

Open
robert3005 wants to merge 1 commit into
developfrom
rk/trusted-len-clippy
Open

robert3005 wants to merge 1 commit into
developfrom
rk/trusted-len-clippy

Conversation

@robert3005

Copy link
Copy Markdown
Contributor

Summary

cargo clippy --release -p vortex-buffer -- -D warnings fails on develop with clippy::manual_map in TrustedLenAdapter::next. With debug assertions compiled out, the match on the inner iterator's next item reduces to a manual Option::map, which clippy rejects. Debug builds are unaffected, which is why it hasn't shown up in CI.

Changes

TrustedLenAdapter::next takes the inner item first, then counts it and checks the length under #[cfg(debug_assertions)]. The debug-build behaviour is the same as before: the count is checked against the promised length on every item, and the adapter asserts that the iterator did not end early. Release builds return the item unchanged, as before.

Checked with:

  • cargo clippy -p vortex-buffer --all-targets --all-features -- -D warnings, in both debug and --release
  • cargo test -p vortex-buffer, in both debug and --release
  • cargo +nightly-2026-09-10 fmt -p vortex-buffer --check

Generated by Claude Code

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 <robert@spiraldb.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011JxDQs8L3TZ6VhZV9Bt6cr
@codspeed

codspeed Bot commented Oct 19, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 11.95%

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

⚠️ 1 benchmark measured no execution time

Nothing ran under measurement, usually because the compiler removed the code under test. This result is not comparable, so it counts as unchanged.

Preventing compiler optimizations

⚠️ 27 benchmarks spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

ℹ️ 40 benchmarks have no flame graph

The flamegraph could not be generated because we failed to resolve the symbols in the profiling trace. This happens when we fail to harvest information about language frames.

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 1 improved benchmark
✅ 2407 untouched benchmarks
⏩ 12 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
⚡ Simulation isolated_runs[u32, (16, 0)] 87.5 µs 78.2 µs +11.95%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing rk/trusted-len-clippy (f1f9102) with develop (92a7db0)

Open in CodSpeed

Footnotes

  1. 12 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants