Skip to content

chore(de-fi): Add separator before type suffix in integer literals.#9433

Merged
daniel-wong-dfinity-org merged 1 commit intomasterfrom
separate-integer-literal-type-suffixes-defi
Mar 19, 2026
Merged

chore(de-fi): Add separator before type suffix in integer literals.#9433
daniel-wong-dfinity-org merged 1 commit intomasterfrom
separate-integer-literal-type-suffixes-defi

Conversation

@daniel-wong-dfinity-org
Copy link
Copy Markdown
Contributor

@daniel-wong-dfinity-org daniel-wong-dfinity-org commented Mar 17, 2026

E.g. 42u64 is changed to 42_u64.

Why: Spaces are good for readability (when used judiciously, ofc).

Why (long version): ThereisareasonthatspaceswereinventedinthefirstplacewhywedonotsimplywriteentireprogramsononelineItisbecausewhenwedispensewithspacesitisprofoundlyunreadabledespitetakingupmuchlessspaceSpacesarenotsomeextravaganceTheyareinfactvitaltogoodhumancomprehensionAndthatisalwaysourgoaltooptimizeFORTHEREADERYouarewelcomeforthemigrainethatthisstatementisinducingLetitbeavaluablelessontoyouaboutthenonextravagenceofspacesNowgoforthandusespacejudiciouslyorelsetherobotswillcomeknockingatyourdoorverysoon

Fix stats: ~462 literals across 91 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.
  1. Then, check out the master commit that this is based on (originally, 40ad82dbd8) and run the tool against all directories owned by the Decentralized Finance team.
for DIRECTORY in \
    rs/bitcoin \
    rs/cross-chain \
    rs/dogecoin \
    rs/ethereum \
    rs/ledger_suite \
    rs/rosetta-api \
    rs/rust_canisters/xrc_mock \
    rs/tests/ckbtc \
    rs/tests/cross_chain \
    rs/tests/financial_integrations \
    rs/tools/check_did \
    rs/utils/ensure
do
    ./bazel-bin/rs/tools/add-integer-type-suffix-separator/add-integer-type-suffix-separator $DIRECTORY
done

…wned code

Changes 42u64 -> 42_u64, 42i32 -> 42_i32, etc.

The tool was run on the following directories:

    rs/bitcoin
    rs/cross-chain
    rs/dogecoin
    rs/ethereum
    rs/ledger_suite
    rs/rosetta-api
    rs/rust_canisters/xrc_mock
    rs/tests/ckbtc
    rs/tests/cross_chain
    rs/tests/financial_integrations
    rs/tools/check_did
    rs/utils/ensure
@github-actions github-actions bot added the chore label Mar 17, 2026
@daniel-wong-dfinity-org daniel-wong-dfinity-org changed the title chore: Add separator before type suffix in integer literals in defi-o… chore(de-fi): Add separator before type suffix in integer literals. Mar 17, 2026
@daniel-wong-dfinity-org daniel-wong-dfinity-org marked this pull request as ready for review March 17, 2026 18:43
@daniel-wong-dfinity-org daniel-wong-dfinity-org requested a review from a team as a code owner March 17, 2026 18:43
@github-actions github-actions bot added the @defi label Mar 17, 2026
@daniel-wong-dfinity-org daniel-wong-dfinity-org added this pull request to the merge queue Mar 19, 2026
Merged via the queue into master with commit a08eb49 Mar 19, 2026
49 of 50 checks passed
@daniel-wong-dfinity-org daniel-wong-dfinity-org deleted the separate-integer-literal-type-suffixes-defi branch March 19, 2026 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants