rustfmt
rustfmt copied to clipboard
Format Rust code
Example code: ```rust // The indentation stays the same, as expected fn foobar() { let x = y else { panic!(); }; } // The indentation is increased every time...
With: ```toml hard_tabs = true braces_style = "AlwaysNextLine" control_brace_style = "AlwaysNextLine" group_imports = "StdExternalCrate" imports_granularity = "One" imports_indent = "Block" imports_layout = "Vertical" indent_style = "Block" newline_style = "Unix" trailing_comma...
[Playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=4744115d7a207179d93ecba705d16daf) Given: ```rust #![feature(dyn_star)] #![allow(incomplete_features)] use core::fmt::Debug; fn main() { let i = 42; let dyn_i = i as dyn* Debug; dbg!(dyn_i); } ``` This is formatted to: ```rust #![feature(dyn_star)]...
rustfmt struggles with `matches!` and if guards. ```rust fn test() { let a = matches!(something.very_very_very.long.even.more.fields, Some(very_long_field_name_name_to_check) if method(very_long_field_name)); } ``` `rustfmt 1.5.1-nightly (c0941dfb 2022-08-21)`
# Solves #5525 * Now extra whitespace is removed from the beginning of the `rhs` expression on the `rewrite_assign_rhs_with` function (`expr.rs - 1977`) if the `lhs` expression ends with whitespace...
Please refer to the linked project below 2 tabs of indentation are being interpreted as more than 2 characters/width, causing rustfmt to think that the line is overflowing. On the...
Tracking issue for unstable option: imports_layout
The following snippet formats with an extra space between `pub` and `extern "C"` if the arguments continue across multiple lines. i.e. rustfmt produces `pub␣␣extern "C"` instead of `pub␣extern "C"`. ```rust...
# Fixes #5507 * A new function was added to `items.rs`. `set_brace_pos` will format generic `struct`s with `where` clauses appropriately based on the `version` provided as a parameter. * Different...
Hello, I am encountering a combination of two issues. ```console $ rustc --version rustc 1.63.0 (4b91a6ea7 2022-08-08) $ cargo fmt --version rustfmt 1.5.1-stable (4b91a6e 2022-08-08) ``` To my understanding there...