Skip to content

Switch to cargo fmt instead of rustfmt directly #343

Open
@FanShupei

Description

@FanShupei

Is your feature request related to a problem? Please describe.

Rust edition may introduce style change (e.g. Edition 2024 introduces). cargo fmt will use edition from Cargo.toml, but currently treefmt invokes rustfmt directly using a global option. There are changes for edition mismatch. nix fmt and cargo fmt giving different results is highly undesirable.

If the project mix up edition 2024/2021 code (allowed by Rust, appears in gradually updating edition), the situation is even worse, nix fmt can not work perfectly since there is no correct edition to specify.

Describe the solution you'd like

Switch to cargo fmt. cargo fmt will automatically detect the edition from Cargo.toml.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions