rustfmt icon indicating copy to clipboard operation
rustfmt copied to clipboard

Format Rust code

Results 485 rustfmt issues
Sort by recently updated
recently updated
newest added

### Input code ```rust fn f() { match x { 0 => S { }, _ => AAAAAAAAA, } } ``` (Note, the 4th line contains 12 spaces, which you...

p-low
feature-request
e-trailing whitespace

When merging imports using `imports_granularity="Module"`, individual crate imports should get their own `use` statement on a new line. ``` // Before this commit: use {library1, library2 as lib2, library3}; //...

pr-not-reviewed

### Documented behavior The [current docs for `imports_granularity = "Module"`](https://github.com/rust-lang/rustfmt/blob/c97996fab61fc09432abcf64dbe3ce2d84f4d679/Configurations.md?plain=1#L1923-L1933) say this: > Merge imports from the same module into a single use statement. Conversely, imports from different modules are...

only-with-option
a-imports

Hello! I just came across the wonderful (currently unstable) commands [`comment_width`](https://github.com/rust-lang/rustfmt/issues/3349) & [`wrap_comments`](https://github.com/rust-lang/rustfmt/issues/3347) which I happily applied to a larger codebase and thought this is the end to comments spanning...

a-comments
only-with-option

The canonicalize() function resolves symlinks, which would cause targets whose "Cargo.toml" is a symlink to be filtered out. This would cause `cargo-fmt` to print an error "Failed to find targets"....

pr-not-reviewed

### Problem If a cargo workspace has a member project whose `Cargo.toml` is a symlink to a valid `Cargo.toml`, then running `cargo fmt` from the member directory fails with: ```...

C-bug
needs-triage

## Problem https://github.com/rust-lang/rustfmt/issues/5797 fixed the [trailing_semicolon](https://rust-lang.github.io/rustfmt/?version=v1.4.30&search=#trailing_semicolon) rule, allowing it only for the last expression in the block. The side-effect of this change is that such snippet ```rust fn main() {...

pr-not-reviewed

``` % rustfmt --version rustfmt 1.7.0-nightly (8679004 2024-05-23) ``` Content of `src/lib.rs`: ```rust /* 0 1 2 3 4 5 6 7 8 9 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 */ // This line has...

a-comments
only-with-option

Using nightly rust: ``` PS C:\src\test> C:\src\c\src\third_party\rust-toolchain\bin\rustfmt.exe --version rustfmt 1.7.0-dev (27eb5e46111 2024-05-14) ``` My directory layout: ``` PS C:\src\test> ls Directory: C:\src\test Mode LastWriteTime Length Name ---- ------------- ------ ----...

only-with-option
os-windows

```rust mod modules { #[rustfmt::skip] #[path = "/dev/null"] mod first; /// ... /// ... #[rustfmt::skip] #[path = "/dev/null"] mod second; } ``` Running rustfmt on this file turns it into:...

a-comments
a-rustfmt::skip