QA: add rustfmt.toml to standardize workspace formatting #547

Closed
pushkarreddyy wants to merge 1 commit from upstream-pr/547 into main
pushkarreddyy commented 2026-11-24 04:43:58 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by pushkarreddyy on 2026-11-24T04:43:58Z.


Motivation

The VIctory workspace is built on the Rust 2024 edition (edition = "2024" in Cargo.toml). Without an explicit rustfmt.toml in the repository root:

  1. rustfmt defaults to Rust 2015/2021 when executed by IDEs, text editors (e.g. rust-analyzer formatting on save), or ad-hoc cargo fmt commands without --edition 2024.
  2. This causes formatting errors on modern 2024 syntax features (such as C-string literals c"..." and let-chains).
  3. Line endings could vary across Windows and non-Windows contributors.

Solution

  • Added rustfmt.toml to the workspace root:
    • edition = "2024": Automatically sets the format parser to Rust 2024.
    • newline_style = "Unix": Enforces consistent LF line endings across all platforms.
    • use_field_init_shorthand = true: Standardizes struct field initialization.
    • use_try_shorthand = true: Standardizes ? operator usage.

No game files used.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6574790546 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/547). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-11-24T04:43:58Z. --- ## Motivation The VIctory workspace is built on the Rust 2024 edition (`edition = "2024"` in `Cargo.toml`). Without an explicit `rustfmt.toml` in the repository root: 1. `rustfmt` defaults to Rust 2015/2021 when executed by IDEs, text editors (e.g. rust-analyzer formatting on save), or ad-hoc `cargo fmt` commands without `--edition 2024`. 2. This causes formatting errors on modern 2024 syntax features (such as C-string literals `c"..."` and let-chains). 3. Line endings could vary across Windows and non-Windows contributors. ## Solution - Added `rustfmt.toml` to the workspace root: - `edition = "2024"`: Automatically sets the format parser to Rust 2024. - `newline_style = "Unix"`: Enforces consistent LF line endings across all platforms. - `use_field_init_shorthand = true`: Standardizes struct field initialization. - `use_try_shorthand = true`: Standardizes `?` operator usage. No game files used.
mercuryVM commented 2026-11-24 06:53:39 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T06:48:30Z.

Review: APPROVED


Tested 55aea2c on Windows 11, RTX 5070, MSVC: cargo test --workspace --no-fail-fast passes (264 passed, 0 failed). cargo fmt --all --check reports the same 168 diff hunks with and without this file, so it changes nothing cargo fmt produces today.

  • Dropping max_width = 100 is neutral, since 100 is rustfmt's default.
  • newline_style = "Unix" matches .gitattributes (* text=auto eol=lf), so it won't fight checkouts.
  • edition = "2024" only matters for standalone rustfmt and editors, which is the point. cargo fmt already takes the edition from Cargo.toml.
  • use_try_shorthand only rewrites try!, which 2024 code can't use anyway, so it is a no-op here.

No issues found.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:review:6034845917 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/547#pullrequestreview-6034845917). Originally posted by [mercuryVM](https://github.com/mercuryVM) on 2026-11-24T06:48:30Z. **Review:** APPROVED --- Tested 55aea2c on Windows 11, RTX 5070, MSVC: `cargo test --workspace --no-fail-fast` passes (264 passed, 0 failed). `cargo fmt --all --check` reports the same 168 diff hunks with and without this file, so it changes nothing `cargo fmt` produces today. - Dropping `max_width = 100` is neutral, since 100 is rustfmt's default. - `newline_style = "Unix"` matches `.gitattributes` (`* text=auto eol=lf`), so it won't fight checkouts. - `edition = "2024"` only matters for standalone `rustfmt` and editors, which is the point. `cargo fmt` already takes the edition from `Cargo.toml`. - `use_try_shorthand` only rewrites `try!`, which 2024 code can't use anyway, so it is a no-op here. No issues found. AI-assisted (Claude Code).
pushkarreddyy commented 2026-11-24 06:55:53 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by pushkarreddyy on 2026-11-24T04:51:55Z.


### Technical Verification & Implementation Details

Context & Architecture

The VIctory workspace is built on Rust 2024 edition (edition = "2024" in Cargo.toml). Without an explicit rustfmt.toml in the repository root:

  1. rustfmt defaults to 2015/2021 when executed by IDEs (e.g. rust-analyzer formatting on save) or raw cargo fmt without explicit CLI flags.
  2. This causes formatting errors on modern 2024 syntax (such as C-string literals c"..." and let-chains).
  3. Line endings vary across Windows and non-Windows contributors.

Changes & Configuration

  • Added root rustfmt.toml:
    • edition = "2024"
    • newline_style = "Unix"
    • use_field_init_shorthand = true
    • use_try_shorthand = true

Git Log Line & Verification

ext 55aea2c QA: add rustfmt.toml to standardize workspace formatting rustfmt.toml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)

  • Passes cargo xtask policy (Rule #1 compliance, zero game assets).
  • Formatted with rustfmt --edition 2024.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7122407713 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/547#issuecomment-7122407713). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-11-24T04:51:55Z. --- ### Technical Verification & Implementation Details #### Context & Architecture The VIctory workspace is built on Rust 2024 edition (`edition = "2024"` in `Cargo.toml`). Without an explicit `rustfmt.toml` in the repository root: 1. `rustfmt` defaults to 2015/2021 when executed by IDEs (e.g. rust-analyzer formatting on save) or raw `cargo fmt` without explicit CLI flags. 2. This causes formatting errors on modern 2024 syntax (such as C-string literals `c"..."` and let-chains). 3. Line endings vary across Windows and non-Windows contributors. #### Changes & Configuration - Added root `rustfmt.toml`: - `edition = "2024"` - `newline_style = "Unix"` - `use_field_init_shorthand = true` - `use_try_shorthand = true` #### Git Log Line & Verification ` ext 55aea2c QA: add rustfmt.toml to standardize workspace formatting rustfmt.toml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) ` - Passes `cargo xtask policy` (Rule #1 compliance, zero game assets). - Formatted with `rustfmt --edition 2024`.
pushkarreddyy commented 2026-11-24 06:56:21 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by pushkarreddyy on 2026-11-24T06:24:42Z.


### Call for Maintainer Review & Merge
Infrastructure and quality assurance improvement:

  • Enforces Rule #1 asset policy and code style consistency across the repository.
  • Non-breaking, zero dependencies on game files.
  • Helps maintainers manage the influx of incoming PRs by automating gates.

@Marvisak: Ready for review and merge when convenient!

<!-- greyfinch-sync:Marvisak/VIctory:comment:7123904710 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/547#issuecomment-7123904710). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-11-24T06:24:42Z. --- ### Call for Maintainer Review & Merge Infrastructure and quality assurance improvement: - Enforces Rule #1 asset policy and code style consistency across the repository. - Non-breaking, zero dependencies on game files. - Helps maintainers manage the influx of incoming PRs by automating gates. @Marvisak: Ready for review and merge when convenient!
pushkarreddyy commented 2026-11-24 08:02:51 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by pushkarreddyy on 2026-11-24T07:33:02Z.


Thank you @mercuryVM for the thorough review and testing on Windows 11 / MSVC! Appreciate the confirmation and approval.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7125113069 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/547#issuecomment-7125113069). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-11-24T07:33:02Z. --- Thank you @mercuryVM for the thorough review and testing on Windows 11 / MSVC! Appreciate the confirmation and approval.
catminou4 commented 2026-11-24 13:01:35 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T12:46:07Z.

Review: COMMENTED


The config additions themselves are reasonable (edition = "2024" matches the workspace, use_try_shorthand, Unix newlines), but this cannot land alone: applying this rustfmt.toml to current main makes cargo fmt --all -- --check report 179 diffs across the workspace (mostly from use_try_shorthand rewriting try!-style/.map_err patterns and reflowing lower.rs, threads.rs, etc.).

Verified locally on macOS (rustc 1.98.1): with the PR's rustfmt.toml in place, cargo fmt --all -- --check exits non-zero with 179 "Diff in" hunks; with main's current rustfmt.toml the tree is clean.

Please bundle a workspace-wide cargo fmt commit with this change (or land the reformat first), otherwise every PR's formatting check (#540's changed-file rustfmt step, #545's xtask qa) starts flagging untouched code.

<!-- greyfinch-sync:Marvisak/VIctory:review:6039426144 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/547#pullrequestreview-6039426144). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-24T12:46:07Z. **Review:** COMMENTED --- The config additions themselves are reasonable (`edition = "2024"` matches the workspace, `use_try_shorthand`, Unix newlines), but this cannot land alone: applying this `rustfmt.toml` to current main makes `cargo fmt --all -- --check` report **179 diffs** across the workspace (mostly from `use_try_shorthand` rewriting `try!`-style/`.map_err` patterns and reflowing `lower.rs`, `threads.rs`, etc.). Verified locally on macOS (rustc 1.98.1): with the PR's `rustfmt.toml` in place, `cargo fmt --all -- --check` exits non-zero with 179 "Diff in" hunks; with main's current `rustfmt.toml` the tree is clean. Please bundle a workspace-wide `cargo fmt` commit with this change (or land the reformat first), otherwise every PR's formatting check (#540's changed-file rustfmt step, #545's `xtask qa`) starts flagging untouched code.
upstream-sync closed this pull request 2026-11-25 01:04:11 +00:00
Marvisak commented 2026-11-25 01:07:44 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:24:44Z.


Automated triage for the maintainers. Closing because it does not change behaviour the project needs (formatting, guards for cases that cannot occur, or notes and translations that cannot be kept current).

If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7148481967 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/547#issuecomment-7148481967). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T00:24:44Z. --- Automated triage for the maintainers. Closing because it does not change behaviour the project needs (formatting, guards for cases that cannot occur, or notes and translations that cannot be kept current). If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory!547
No description provided.