rustfmt
rustfmt copied to clipboard
Format Rust code
If I have some code that is formatted perfectly correctly for a `max_width = 50`: ```rust fn example() { let x = [1, 2, 3] .iter() .rev() .enumerate() .count(); }...
If I ask `cargo fmt` from 1.81.0 to format this code, I get: ```rust const COUNT: u8 = 5; pub struct Thing; impl Thing { pub fn set() { #[allow(clippy::assertions_on_constants)]...
Here's some example code: ```rust impl for UnqualifiedLocalImports { fn check_item(&mut self, cx: &LateContext LateLintPass, item: &'tcx hir::Item
In programming, arrays of data are sometimes formatted with X values per line, usually a multiple of 10 or 2. This allows you to easily find and inspect the data...
Tracking issue for unstable option: trailing_comma
"cargo fmt" command does not remove white spaces in derive block. For example i expected this ```rust #[derive(serde :: Serialize)] enum Something { Variant } ``` to become this ```rust...
[lib.rs.gz](https://github.com/user-attachments/files/17048881/lib.rs.gz) Un-gzip the attached lib.rs make it the only file in a crate run `cargo fmt` See ``` thread 'main' panicked at library/core/src/slice/sort/shared/smallsort.rs:862:5: user-provided comparison function does not correctly implement...
Add `struct ConfigOption` to replace the 5-element tuple used for `Config` fields, to make the code more readable. The tuple element 3 is actually `true` if the option is stable,...
For all version I could tests (master and nightly) this code: ```rust pub trait MyLongTraitName: MyLongBoundName< MyLongAssociatedType: SomeAnotherBound< YetAnotherType: YetAnotherBound, YetAnotherType2: YetAnotherBound2 >, OtherType: SmallBound + SmallBound2 + AnotherLongBound< WithSomeType:...
I'm building an app based on dioxus that uses the `rsx!` proc macro extensively. it's basically html with embedded rust closures. the `rsx!` macro even has an autoformatter [0] used...