mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Merge pull request #1732 from olson-sean-k/issue-1377
Keep brace on same line as `match` when using `ClosingNextLine`.
This commit is contained in:
commit
f74be44b1c
@ -1461,8 +1461,8 @@ fn rewrite_match(
|
||||
let cond_str = try_opt!(cond.rewrite(context, cond_shape));
|
||||
let alt_block_sep = String::from("\n") + &shape.indent.block_only().to_string(context.config);
|
||||
let block_sep = match context.config.control_brace_style() {
|
||||
ControlBraceStyle::AlwaysSameLine => " ",
|
||||
_ => alt_block_sep.as_str(),
|
||||
ControlBraceStyle::AlwaysNextLine => alt_block_sep.as_str(),
|
||||
_ => " ",
|
||||
};
|
||||
let mut result = format!("match {}{}{{", cond_str, block_sep);
|
||||
|
||||
|
@ -3,4 +3,8 @@
|
||||
|
||||
fn main() {
|
||||
if lorem { println!("ipsum!"); } else { println!("dolor!"); }
|
||||
match magi {
|
||||
Homura => "Akemi",
|
||||
Madoka => "Kaname",
|
||||
}
|
||||
}
|
||||
|
@ -3,4 +3,8 @@
|
||||
|
||||
fn main() {
|
||||
if lorem { println!("ipsum!"); } else { println!("dolor!"); }
|
||||
match magi {
|
||||
Homura => "Akemi",
|
||||
Madoka => "Kaname",
|
||||
}
|
||||
}
|
||||
|
@ -3,4 +3,8 @@
|
||||
|
||||
fn main() {
|
||||
if lorem { println!("ipsum!"); } else { println!("dolor!"); }
|
||||
match magi {
|
||||
Homura => "Akemi",
|
||||
Madoka => "Kaname",
|
||||
}
|
||||
}
|
||||
|
@ -10,4 +10,9 @@ fn main() {
|
||||
{
|
||||
println!("dolor!");
|
||||
}
|
||||
match magi
|
||||
{
|
||||
Homura => "Akemi",
|
||||
Madoka => "Kaname",
|
||||
}
|
||||
}
|
||||
|
@ -7,4 +7,8 @@ fn main() {
|
||||
} else {
|
||||
println!("dolor!");
|
||||
}
|
||||
match magi {
|
||||
Homura => "Akemi",
|
||||
Madoka => "Kaname",
|
||||
}
|
||||
}
|
||||
|
@ -8,4 +8,8 @@ fn main() {
|
||||
else {
|
||||
println!("dolor!");
|
||||
}
|
||||
match magi {
|
||||
Homura => "Akemi",
|
||||
Madoka => "Kaname",
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user