fix(mft): use bit_width() to satisfy clippy::manual_bit_width on newer nightly - #554
Merged
Conversation
…r nightly The nightly canary (floating latest nightly) flagged `estimated_avg_depth` with clippy's new `manual_bit_width` lint: the manual `u32::BITS - dir_count.leading_zeros()` bit-count is now linted in favor of the dedicated `bit_width()` method. Switch to it — the value is identical (bit_width == BITS - leading_zeros for the highest-set-bit position), and `bit_width()` already compiles on the pinned nightly, so this satisfies the future lint without disturbing the current PR gate. Clears the linux + windows canary clippy lanes. The macOS canary lane fails separately in the upstream `cpufeatures` crate (a const-assert that newer nightlies break on aarch64-apple-darwin), which is out of our tree and tracked with the other pin-bump blockers (#492).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The nightly canary (which builds against the latest floating nightly, ahead of our pin) went red on a new clippy lint.
clippy::manual_bit_widthnow flags the manual highest-set-bit computation inestimated_avg_depth:This fix switches to the dedicated
bit_width()method (the lint's own suggestion). The value is identical —bit_width()==u32::BITS - leading_zeros()for the highest-set-bit position — andbit_width()already compiles on our pinned nightly, so this satisfies the future lint without disturbing the current PR gate.Effect on the canary
cargo check, inside the upstreamcpufeaturescrate — a compile-time assertion (_AARCH64_APPLE_TARGETS_EXPECTED_FEATURES) that newer nightlies break on Apple Silicon. That is transitive (viasha2→polars andaes→aes-gcm→uffs-security), out of our tree, and clears only with an upstreamcpufeaturesrelease. Tracked with the other pin-bump blockers in 🐤 Nightly Canary: upcoming-toolchain regression — f6aab89 #492.Validation
lint-prod,lint-prod-windows(xwin),rustdoc, andfmt-checkall pass locally. Behavior is unchanged (pure refactor of an integer bit-count).