diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 62a4fce..9cfaf17 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -44,10 +44,10 @@ jobs: persist-credentials: false - name: Install toolchain - run: rustup toolchain install nightly --component rustfmt + run: rustup component add rustfmt - name: Run rustfmt checks - run: rustup run nightly cargo fmt --check --all + run: cargo fmt --check --all lint: name: Lint diff --git a/.vscode/settings.json b/.vscode/settings.json index e02d193..ffe31b9 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -14,9 +14,6 @@ "**/Cargo.lock": true, ".git/": true }, - "rust-analyzer.rustfmt.extraArgs": [ - "+nightly" - ], "[json]": { "editor.defaultFormatter": "vscode.json-language-features", "editor.tabSize": 2 diff --git a/README.md b/README.md index e3ae2bc..9b0ff57 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Opinionated template for multi-crate Rust workspaces, with: The following software is expected to be installed and available in `PATH`: -- [rustup][rustup] – Rust toolchain manager. Both the stable and nightly toolchains are used: nightly for `rustfmt` (`rustfmt.toml` contains unstable options), stable for everything else. +- [rustup][rustup] – Rust toolchain manager. Only the stable toolchain is used. - [just][just] – Command runner. See the `justfile` for available recipes. - [taplo][taplo] – TOML formatter. Configured by `taplo.toml`. - [markdownlint-cli2][markdownlint-cli2] – Markdown linter. Configured by `.markdownlint.json`. diff --git a/justfile b/justfile index d63e8dd..c70f905 100644 --- a/justfile +++ b/justfile @@ -6,7 +6,7 @@ default: # Run rustfmt fmt: - cargo +nightly fmt --all + cargo fmt --all # Check whether the code compiles check: diff --git a/rustfmt.toml b/rustfmt.toml index 2fd133d..db038ee 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,17 +1,22 @@ # Reference: https://rust-lang.github.io/rustfmt/ -condense_wildcard_suffixes = true -format_macro_bodies = false -format_macro_matchers = false -group_imports = "Preserve" -imports_granularity = "One" match_block_trailing_comma = true -normalize_comments = true -normalize_doc_attributes = true -overflow_delimited_expr = true -reorder_impl_items = true single_line_if_else_max_width = 0 single_line_let_else_max_width = 0 style_edition = "2024" use_field_init_shorthand = true use_try_shorthand = true + +# The following options are nightly-only. They are commented out because we +# format with the stable toolchain; uncomment when any one of them becomes +# available in stable. + +# condense_wildcard_suffixes = true +# format_macro_bodies = false +# format_macro_matchers = false +# group_imports = "Preserve" +# imports_granularity = "One" +# normalize_comments = true +# normalize_doc_attributes = true +# overflow_delimited_expr = true +# reorder_impl_items = true