Skip to content

fix(mft): use bit_width() to satisfy clippy::manual_bit_width on newer nightly - #554

Merged
githubrobbi merged 1 commit into
mainfrom
fix/canary-manual-bit-width
Jul 13, 2026
Merged

fix(mft): use bit_width() to satisfy clippy::manual_bit_width on newer nightly#554
githubrobbi merged 1 commit into
mainfrom
fix/canary-manual-bit-width

Conversation

@githubrobbi

Copy link
Copy Markdown
Collaborator

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_width now flags the manual highest-set-bit computation in estimated_avg_depth:

let log2 = (u32::BITS - self.dir_count.leading_zeros()) as usize;

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 — and bit_width() already compiles on our pinned nightly, so this satisfies the future lint without disturbing the current PR gate.

Effect on the canary

  • Clears the linux + windows canary clippy lanes.
  • The macOS lane fails separately and earlier, in cargo check, inside the upstream cpufeatures crate — a compile-time assertion (_AARCH64_APPLE_TARGETS_EXPECTED_FEATURES) that newer nightlies break on Apple Silicon. That is transitive (via sha2→polars and aesaes-gcmuffs-security), out of our tree, and clears only with an upstream cpufeatures release. Tracked with the other pin-bump blockers in 🐤 Nightly Canary: upcoming-toolchain regression — f6aab89 #492.

Validation

lint-prod, lint-prod-windows (xwin), rustdoc, and fmt-check all pass locally. Behavior is unchanged (pure refactor of an integer bit-count).

…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).
@githubrobbi
githubrobbi enabled auto-merge July 13, 2026 05:55
@githubrobbi
githubrobbi added this pull request to the merge queue Jul 13, 2026
Merged via the queue into main with commit d936525 Jul 13, 2026
21 checks passed
@githubrobbi
githubrobbi deleted the fix/canary-manual-bit-width branch July 13, 2026 06:13
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.

1 participant