fix(fmt): tune rustfmt rules for ink! macros - #852
Open
Tenny150 wants to merge 1 commit into
Open
Conversation
- Add rust-toolchain.toml pinning nightly channel with rustfmt and clippy components so every contributor uses the same formatter. - Add rustfmt.toml with format_macro_matchers = true (nightly-only) so #[ink::contract], #[ink::test] and non_reentrant! macro calls are fully formatted. Also sets format_macro_bodies, edition 2021, max_width 100 and a handful of import-ordering options. - Update smoke-ci.yml: install nightly rustfmt in a dedicated step and run 'cargo +nightly fmt --check' instead of stable fmt. Stable toolchain is still used for clippy and tests. Closes MettaChain#783
|
@Tenny150 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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
Fixes #783
#[ink::contract],#[ink::test]andpropchain_traits::non_reentrant!macros were not being formatted according to project standards because the stablerustfmtdoes not support theformat_macro_matchersoption.Changes
rust-toolchain.toml(new)Pins the project to the nightly toolchain with explicit
rustfmtandclippycomponents, ensuring every contributor and CI run uses the same formatter version that supports nightly-only options.rustfmt.toml(new)format_macro_matcherstrue#[ink::contract],#[ink::test],non_reentrant!)format_macro_bodiestruemacro_rules!definition bodiesedition"2021"max_width100imports_granularity"Crate"group_imports"StdExternalCrate"fn_args_layout"Tall"format_stringstruereorder_impl_itemstrue.github/workflows/smoke-ci.yml(updated)rustfmtcomponent.cargo fmt --checkwithcargo +nightly fmt --check.clippy) for linting and testing.Acceptance Criteria (from issue)
cargo +nightly fmtruns cleanly with macro formatting enabledcargo +nightly fmt --checkin smoke-ci.yml)