-
Notifications
You must be signed in to change notification settings - Fork 904
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add multiline_{closure,match_arm}_forces_block
multiline_closure_forces_block = false (default): result.and_then(|maybe_value| match maybe_value { None => ..., Some(value) => ..., }) multiline_closure_forces_block = true: result.and_then(|maybe_value| { match maybe_value { None => ..., Some(value) => ..., } }) multiline_match_arm_forces_block = false (default): match lorem { None => if ipsum { println!("Hello World"); }, Some(dolor) => ..., } multiline_match_arm_forces_block = true: match lorem { None => { if ipsum { println!("Hello World"); } } Some(dolor) => ..., }
- Loading branch information
Showing
11 changed files
with
167 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
tests/source/configs-multiline_closure_forces_block-false.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// rustfmt-multiline_closure_forces_block: false | ||
// Option forces multiline closure bodies to be wrapped in a block | ||
|
||
fn main() { | ||
result.and_then(|maybe_value| { | ||
match maybe_value { | ||
None => Err("oops"), | ||
Some(value) => Ok(1), | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// rustfmt-multiline_closure_forces_block: true | ||
// Option forces multiline closure bodies to be wrapped in a block | ||
|
||
fn main() { | ||
result.and_then(|maybe_value| match maybe_value { | ||
None => Err("oops"), | ||
Some(value) => Ok(1), | ||
}); | ||
} |
13 changes: 13 additions & 0 deletions
13
tests/source/configs-multiline_match_arm_forces_block-false.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// rustfmt-multiline_match_arm_forces_block: false | ||
// Option forces multiline match arm bodies to be wrapped in a block | ||
|
||
fn main() { | ||
match lorem { | ||
Lorem::Ipsum => { | ||
if ipsum { | ||
println!("dolor"); | ||
} | ||
} | ||
Lorem::Dolor => println!("amet"), | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
tests/source/configs-multiline_match_arm_forces_block-true.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// rustfmt-multiline_match_arm_forces_block: true | ||
// Option forces multiline match arm bodies to be wrapped in a block | ||
|
||
fn main() { | ||
match lorem { | ||
Lorem::Ipsum => if ipsum { | ||
println!("dolor"); | ||
}, | ||
Lorem::Dolor => println!("amet"), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// rustfmt-multiline_closure_forces_block: false | ||
// Option forces multiline closure bodies to be wrapped in a block | ||
|
||
fn main() { | ||
result.and_then(|maybe_value| match maybe_value { | ||
None => Err("oops"), | ||
Some(value) => Ok(1), | ||
}); | ||
} |
11 changes: 11 additions & 0 deletions
11
tests/target/configs-multiline_closure_forces_block-true.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// rustfmt-multiline_closure_forces_block: true | ||
// Option forces multiline closure bodies to be wrapped in a block | ||
|
||
fn main() { | ||
result.and_then(|maybe_value| { | ||
match maybe_value { | ||
None => Err("oops"), | ||
Some(value) => Ok(1), | ||
} | ||
}); | ||
} |
11 changes: 11 additions & 0 deletions
11
tests/target/configs-multiline_match_arm_forces_block-false.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// rustfmt-multiline_match_arm_forces_block: false | ||
// Option forces multiline match arm bodies to be wrapped in a block | ||
|
||
fn main() { | ||
match lorem { | ||
Lorem::Ipsum => if ipsum { | ||
println!("dolor"); | ||
}, | ||
Lorem::Dolor => println!("amet"), | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
tests/target/configs-multiline_match_arm_forces_block-true.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// rustfmt-multiline_match_arm_forces_block: true | ||
// Option forces multiline match arm bodies to be wrapped in a block | ||
|
||
fn main() { | ||
match lorem { | ||
Lorem::Ipsum => { | ||
if ipsum { | ||
println!("dolor"); | ||
} | ||
} | ||
Lorem::Dolor => println!("amet"), | ||
} | ||
} |