You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
rustfmt fails to format any branches inside a match statement if it cannot format the whole statement.
Expected Behaviour
All other branches in the match statement should be formatted correctly, even if one branch fails to format.
Steps to reproduce
Try to format the following main.rs:
fnmain(){matchtrue{false => {println!("nothing inside this match statement is formatted anymore")}
_ => "String causing the failure xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",};}
Output of rustfmt --check: None
Now remove one of the x placeholder characters in the string and format again.
Output of rustfmt --check:
fn main() {
match true {
- false => {println!("nothing inside this match statement is formatted anymore")
+ false => {
+ println!("nothing inside this match statement is formatted anymore")
}
- _ => "String causing the failure xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
+ _ => {
+ "String causing the failure xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
+ }
};
}
Additional Information
Tested on rustfmt 1.6.0-nightly (fcab248 2023-10-13)
The text was updated successfully, but these errors were encountered:
Error
rustfmt fails to format any branches inside a match statement if it cannot format the whole statement.
Expected Behaviour
All other branches in the match statement should be formatted correctly, even if one branch fails to format.
Steps to reproduce
Try to format the following
main.rs
:Output of
rustfmt --check
:None
Now remove one of the
x
placeholder characters in the string and format again.Output of
rustfmt --check
:Additional Information
Tested on
rustfmt 1.6.0-nightly (fcab248 2023-10-13)
The text was updated successfully, but these errors were encountered: