Cargo fmt not working

⚓ Rust    📅 2025-12-21    👤 surdeus    👁️ 2      

surdeus

Info

This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: Cargo fmt not working

Why does my cargo fmt does not work ?

Toolchain is 1.91, rustup is up to date

cargo fmt -v
[lib (2024)] "src/lib.rs"
[bin (2024)] "src/main.rs"
rustfmt --edition 2024 src/lib.rs src/main.rs
cargo fmt -- -v
Formatting src/app.rs
Formatting src/central_panel.rs
Formatting src/lib.rs
Spent 0.001 secs in the parsing phase, and 0.005 secs in the formatting phase
Formatting src/main.rs
Spent 0.000 secs in the parsing phase, and 0.000 secs in the formatting phase

But I have other file like "src/central_panel.rs" which contains non formatted code

When I run manually rustfmt

rustfmt src/central_panel.rs  -v
Formatting src/central_panel.rs
Spent 0.001 secs in the parsing phase, and 0.004 secs in the formatting phase

When I add a big trailing space in central_panel.rs I have

error[internal]: left behind trailing whitespace
   --> src/central_panel.rs:181:181:1
    |
181 |                                 
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |

warning: rustfmt has failed to format. See previous 1 errors.

and cargo clippy is not throwing any error

5 posts - 2 participants

Read full topic

🏷️ Rust_feed