Format source codes and update tests

This commit is contained in:
topecongiro 2017-07-21 17:55:52 +09:00
parent a16307a70f
commit 68c6fe70fd
6 changed files with 34 additions and 31 deletions

View File

@ -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

View File

@ -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()

View File

@ -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;

View File

@ -118,8 +118,7 @@ fn floaters() {
})
.quux();
a +
match x {
a + match x {
true => "yay!",
false => "boo!",
}

View File

@ -114,8 +114,7 @@ fn floaters() {
})
.quux();
a +
match x {
a + match x {
true => "yay!",
false => "boo!",
}.bar()

View 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");
});
}