mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-02 11:44:28 +00:00
Format source codes and update tests
This commit is contained in:
parent
a16307a70f
commit
68c6fe70fd
@ -2899,8 +2899,7 @@ pub fn rewrite_assign_rhs<S: Into<String>>(
|
||||
shape: Shape,
|
||||
) -> Option<String> {
|
||||
let lhs = lhs.into();
|
||||
let last_line_width = last_line_width(&lhs) -
|
||||
if lhs.contains('\n') {
|
||||
let last_line_width = last_line_width(&lhs) - if lhs.contains('\n') {
|
||||
shape.indent.width()
|
||||
} else {
|
||||
0
|
||||
|
@ -829,8 +829,7 @@ fn rewrite_trait_ref(
|
||||
result_len: usize,
|
||||
) -> Option<String> {
|
||||
// 1 = space between generics and trait_ref
|
||||
let used_space = 1 + polarity_str.len() +
|
||||
if generics_str.contains('\n') {
|
||||
let used_space = 1 + polarity_str.len() + if generics_str.contains('\n') {
|
||||
last_line_width(&generics_str)
|
||||
} else {
|
||||
result_len + generics_str.len()
|
||||
|
@ -630,9 +630,7 @@ impl<'a> FmtVisitor<'a> {
|
||||
let use_item_length = items_left
|
||||
.iter()
|
||||
.take_while(|ppi| {
|
||||
is_use_item(&***ppi) &&
|
||||
(!reorder_imports_in_group ||
|
||||
{
|
||||
is_use_item(&***ppi) && (!reorder_imports_in_group || {
|
||||
let current = self.codemap.lookup_line_range(item_bound(&ppi));
|
||||
let in_same_group = current.lo < last.hi + 2;
|
||||
last = current;
|
||||
|
@ -118,8 +118,7 @@ fn floaters() {
|
||||
})
|
||||
.quux();
|
||||
|
||||
a +
|
||||
match x {
|
||||
a + match x {
|
||||
true => "yay!",
|
||||
false => "boo!",
|
||||
}
|
||||
|
@ -114,8 +114,7 @@ fn floaters() {
|
||||
})
|
||||
.quux();
|
||||
|
||||
a +
|
||||
match x {
|
||||
a + match x {
|
||||
true => "yay!",
|
||||
false => "boo!",
|
||||
}.bar()
|
||||
|
9
tests/target/issue-831.rs
Normal file
9
tests/target/issue-831.rs
Normal file
@ -0,0 +1,9 @@
|
||||
fn main() {
|
||||
let y = a.iter().any(|x| {
|
||||
println!("a");
|
||||
}) || b.iter().any(|x| {
|
||||
println!("b");
|
||||
}) || c.iter().any(|x| {
|
||||
println!("c");
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue
Block a user