rustfmt
rustfmt copied to clipboard
Format Rust code
So, #8 says "format macros" (hard in general); #3445 suggests formatting macros using `{ .. }` braces as a `Block`; #2905 proposes formatting expression-like macros... ... general solutions are hard...
The libc crate has some macros, called `s!`, `f!`, etc. which take a series of items: ```rust f! { fn foo(); fn bar(); // ... } ``` I know that...
We have a rule that puts the second operand of a chain on the same line as the first if the first is 4 characters or less: ```rust fn foo()...
Tracking issue for unstable option: overflow_delimited_expr
Currently, splitting behaviour appears to be mostly dependent on `max_width`, unless some specific option overrides/augments this. I don't fully understand why, either. Example, with `max_width = 140` (line = 105...
When there are many arguments in the `#[derive(...)]` attribute, placing one argument per line makes the code vertically long and difficult to read. Could you consider adding an option to...
From Yacin Tmimi: > The issue is that we're not accounting for cases where we don't have a body, or where the body is on the next line. Hopefully these...
The following is rustfmt's formatting on 2025-02-17 4d91de4e48 (the version currently on the Rust Playground): ```rust impl where T: 'a + TransparentWrapper + ?Sized, I: Invariants, { pub(crate) fn transparent_wrapper_into_inner(...
The problem occurs in the following code, note that the longest line is exactly 100 columns: ```rust pub trait Manager { fn attach_device(&self, seat_id: &str, sysfs_path: &str, interactive: bool) ->...
Hi rustfmt team, This idea has come up regularly since 2017 — users keep asking for `#[derive(...)]` traits to be sorted automatically, just like imports. And each time, it’s been...