rustfmt
rustfmt copied to clipboard
Format Rust code
Formatting the following code with `cargo fmt` leaves behind a space and curly braces. Before: ```rust use core::{ slice, fmt::{}, }; ``` (there are 4 spaces on the seemingly empty...
For code: ```rust pub trait Foo { type Bar where Self: Sized; } impl Foo for u8 { // note: there is a space between `u16` and LineFeed type Bar...
Rust v1.80 (`rustfmt 1.7.0-stable (0514789 2024-07-21)`) and Nightly (`rustfmt 1.7.1-nightly (64ebd39 2024-08-03)`) both remove values from static items: ```rust extern "C" { static TEST: i32 = 42; } ``` When...
I have a `rustfmt.toml` that contains many unstable options that I use for some of my personal projects. When contributing to other people's open source projects who use the default...
This reduces syn's features to "full", "parsing", "proc-macro", "printing" only for that proc macro. Also bumped edition to 2021.
rustfmt currently provides the ability to print configuration details in various forms: * `default` (documented briefly [here](https://github.com/rust-lang/rustfmt/blob/d8ae6a99e623fdecff6f2d7d9feb157c8ff0e3f8/README.md?plain=1#L199)) which dumps the full set of configuration options with their default values, regardless...
`rusfmt` hangs when using [cfg-if](https://crates.io/crates/cfg-if) macro To reproduce run `rustftm main.rs`, where: ```rust // main.rs cfg_if::cfg_if! { if #[cfg(not(feature = "client"))] { if #[cfg(feature = "server")] { } } }...
Whenever the order of a struct or enum would be completely irrelevant, I like to keep them in alphabetic order. However, this gets slightly annoying to maintain when adding new...
The empty line after the initial comment within the struct definition here is there deliberately to separate it from the comments associated with the first attribute. rustfmt should not remove...