mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-13 04:26:48 +00:00
Set combine_control_expr to false by default and true in rfc-rustfmt
This commit is contained in:
parent
0292640e14
commit
41b7cc6a73
@ -4,3 +4,4 @@ control_style = "Rfc"
|
||||
where_style = "Rfc"
|
||||
generics_indent = "Block"
|
||||
fn_call_style = "Block"
|
||||
combine_control_expr = true
|
||||
|
@ -576,7 +576,7 @@ create_config! {
|
||||
"What Write Mode to use when none is supplied: Replace, Overwrite, Display, Diff, Coverage";
|
||||
condense_wildcard_suffixes: bool, false, "Replace strings of _ wildcards by a single .. in \
|
||||
tuple patterns";
|
||||
combine_control_expr: bool, true, "Combine control expressions with funciton calls."
|
||||
combine_control_expr: bool, false, "Combine control expressions with funciton calls."
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
133
tests/target/configs-combine_control_expr-false.rs
Normal file
133
tests/target/configs-combine_control_expr-false.rs
Normal file
@ -0,0 +1,133 @@
|
||||
// rustfmt-fn_call_style: Block
|
||||
// rustfmt-combine_control_expr: false
|
||||
// Combining openings and closings. See https://github.com/rust-lang-nursery/fmt-rfcs/issues/61.
|
||||
|
||||
fn main() {
|
||||
// Call
|
||||
foo(bar(
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
|
||||
));
|
||||
|
||||
// Mac
|
||||
foo(foo!(
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
|
||||
));
|
||||
|
||||
// MethodCall
|
||||
foo(x.foo::<Bar, Baz>(
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
|
||||
));
|
||||
|
||||
// Block
|
||||
foo!({
|
||||
foo();
|
||||
bar();
|
||||
});
|
||||
|
||||
// Closure
|
||||
foo(|x| {
|
||||
let y = x + 1;
|
||||
y
|
||||
});
|
||||
|
||||
// Match
|
||||
foo(match opt {
|
||||
Some(x) => x,
|
||||
None => y,
|
||||
});
|
||||
|
||||
// Struct
|
||||
foo(Bar {
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
|
||||
});
|
||||
|
||||
// If
|
||||
foo!(
|
||||
if x {
|
||||
foo();
|
||||
} else {
|
||||
bar();
|
||||
}
|
||||
);
|
||||
|
||||
// IfLet
|
||||
foo!(
|
||||
if let Some(..) = x {
|
||||
foo();
|
||||
} else {
|
||||
bar();
|
||||
}
|
||||
);
|
||||
|
||||
// While
|
||||
foo!(
|
||||
while x {
|
||||
foo();
|
||||
bar();
|
||||
}
|
||||
);
|
||||
|
||||
// WhileLet
|
||||
foo!(
|
||||
while let Some(..) = x {
|
||||
foo();
|
||||
bar();
|
||||
}
|
||||
);
|
||||
|
||||
// ForLoop
|
||||
foo!(
|
||||
for x in y {
|
||||
foo();
|
||||
bar();
|
||||
}
|
||||
);
|
||||
|
||||
// Loop
|
||||
foo!(
|
||||
loop {
|
||||
foo();
|
||||
bar();
|
||||
}
|
||||
);
|
||||
|
||||
// Tuple
|
||||
foo((
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
|
||||
));
|
||||
|
||||
// AddrOf
|
||||
foo(&bar(
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
|
||||
));
|
||||
|
||||
// Box
|
||||
foo(box Bar {
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
|
||||
});
|
||||
|
||||
// Unary
|
||||
foo(!bar(
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
|
||||
));
|
||||
|
||||
// Try
|
||||
foo(bar(
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
|
||||
)?);
|
||||
|
||||
// Cast
|
||||
foo(Bar {
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,
|
||||
} as i64);
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
// rustfmt-fn_call_style: Block
|
||||
// rustfmt-combine_control_expr: true
|
||||
// Combining openings and closings. See https://github.com/rust-lang-nursery/fmt-rfcs/issues/61.
|
||||
|
||||
fn main() {
|
Loading…
Reference in New Issue
Block a user