feat: Tool that changes 42u64 to 42_u64.#9418
Open
daniel-wong-dfinity-org wants to merge 3 commits intomasterfrom
Open
feat: Tool that changes 42u64 to 42_u64.#9418daniel-wong-dfinity-org wants to merge 3 commits intomasterfrom
daniel-wong-dfinity-org wants to merge 3 commits intomasterfrom
Conversation
…ach team, create PRs from those fixes, then, once all those changes are in, I will enforce this superior way of writing Rust by adding a GitHub workflow.
3d7bd1b to
fa7e0f7
Compare
…, functionality is the same.
This was referenced Mar 17, 2026
basvandijk
reviewed
Mar 17, 2026
Collaborator
There was a problem hiding this comment.
It's indeed more readable to separate the type suffix with an underscore from the number.
But why not do this via the built-in unseparated_literal_suffix clippy lint by adding
-W clippy::unseparated_literal_suffix to ci/scripts/rust-lint.sh and bazel/conf/.bazelrc.build?
It also supports autofixing like:
cargo clippy --fix -- -W clippy::unseparated_literal_suffix
which we could invoke in our autofix job.
github-merge-queue bot
pushed a commit
that referenced
this pull request
Mar 17, 2026
…9434) E.g. `42u64` is changed to `42_u64`. Fix stats: ~31 literals across 12 files. How to re-create these changes: 1. Build the tool. It is not in master yet; rather, it is in review in [PR 9418]. Until that happens, you'll first need to check out `add-integer-type-suffix-separator-tool-daniel-wong`. Then, `bazel build //rs/tools/add-integer-type-suffix-separator`. [PR 9418]: #9418 2. Then, check out the master commit that this is based on (originally, `40ad82dbd8`) and run the tool against all directories owned by the Node team. ``` for DIRECTORY in \ rs/boundary_node \ rs/ic_os \ rs/tests/boundary_nodes \ rs/tests/nested \ rs/tests/node do ./bazel-bin/rs/tools/add-integer-type-suffix-separator/add-integer-type-suffix-separator $DIRECTORY done git restore \ rs/ic_os/networking/nss_icos \ rs/ic_os/metrics/fstrim_tool \ rs/tests/nested/nns_recovery ```
github-merge-queue bot
pushed a commit
that referenced
this pull request
Mar 18, 2026
…ls. (#9412) E.g. change `42u64` to `42_u64`. This improves readability by clearly separating the number from its type suffix. Fixed 168 numeric literals across 53 files. Changes were made by running ``` for DIRECTORY in rs/nns rs/sns rs/nervous_system rs/registry do cargo run -p add-integer-type-suffix-separator -- $DIRECTORY done ``` The tool is not yet in `master` branch; rather, it can be found in draft #9418, which will be sent out for review "very soon". Co-Authored with: Claude
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.
I will
Co-written with Claude.