rustfmt
rustfmt copied to clipboard
Format Rust code
If you format... ```rust #[allow()] unsafe extern "C" { #[allow()] pub fn foo(#[allow()] arg: *mut u8, #[allow()]...); } ``` Then it will format into ```rust #[allow()] unsafe extern "C" {...
```rust // rustfmt-wrap_comments: true /// ```xxx``` /// /// xxx pub struct X; ``` ```console $ rustfmt --check --config=wrap_comments=true :4:4:4 | 4 | /// | ^ | = note: set `error_on_unformatted...
Tracking issue documenting `style_edition=2027` changes.
It's unlikely that Rustfmt 2.0 will be released for a while, if ever, so it would be nice if `--skip-children` could be stabilised so we can use stable Rustfmt with...
I really don't know how to describe this ... How i found it ??? This is the simplest case I've tried to summarize. For the code: ``` rust mod any...
```sh ❯ rustfmt --version rustfmt 1.8.0-stable (4d91de4e48 2025-02-17) ``` Consider the following file `foo.rs`: ```rust fn f() {} // This has trailing whitespace ``` The trailing whitespace remains when calling...
```rust fn a() -> /* my super detailed comment on what this bool is */ bool {} ``` The comment is entirely eaten: ```rust fn a() -> bool {} ```
Documentation mentions at - https://rust-lang.github.io/rustfmt/?version=v1.8.0&search=#inline_attribute_width - https://rust-lang.github.io/rustfmt/?version=v1.8.0&search=#enum_discrim_align_threshold ``` Default value: 0 Possible values: any positive integer ``` This is misleading/contradicting because 0 is not a positive integer.
I think this is the correct behavior. Also see #5364