From df4fb8a05b95f770304dae63c0bd90bb7408a232 Mon Sep 17 00:00:00 2001 From: Nick Cameron Date: Tue, 24 Jul 2018 15:48:23 +1200 Subject: [PATCH] Reformatting after rebase --- src/chains.rs | 2 +- src/closures.rs | 3 ++- src/formatting.rs | 3 +-- src/macros.rs | 31 +++++++++++++++---------------- src/pairs.rs | 2 +- src/reorder.rs | 13 +++++++------ 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/chains.rs b/src/chains.rs index 45b45b16732a..7acb9b9126f4 100644 --- a/src/chains.rs +++ b/src/chains.rs @@ -302,7 +302,7 @@ trait ChainFormatter { // foo.bar // .baz() // ``` - // If `bar` were not part of the root, then baz would be orphaned and 'float'. + // If `bar` were not part of the root, then foo would be orphaned and 'float'. fn format_root( &mut self, parent: &ChainItem, diff --git a/src/closures.rs b/src/closures.rs index 128e1dc8e0b6..c03c8e6b6065 100644 --- a/src/closures.rs +++ b/src/closures.rs @@ -376,7 +376,8 @@ where ast::ExprKind::Closure(..) => true, _ => false, }).unwrap_or(false) - }).count() > 1 + }).count() + > 1 } fn is_block_closure_forced(context: &RewriteContext, expr: &ast::Expr) -> bool { diff --git a/src/formatting.rs b/src/formatting.rs index ee2539a2fa50..42ab4e89c3bc 100644 --- a/src/formatting.rs +++ b/src/formatting.rs @@ -246,8 +246,7 @@ impl FormattingError { fl.file .get_line(fl.lines[0].line_index) .map(|l| l.into_owned()) - }) - .unwrap_or_else(|| String::new()), + }).unwrap_or_else(|| String::new()), } } diff --git a/src/macros.rs b/src/macros.rs index 91c29958ba16..b55375b949c1 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -1118,22 +1118,21 @@ fn indent_macro_snippet( }).min()?; Some( - first_line + "\n" - + &trimmed_lines - .iter() - .map( - |&(trimmed, ref line, prefix_space_width)| match prefix_space_width { - _ if !trimmed => line.to_owned(), - Some(original_indent_width) => { - let new_indent_width = indent.width() - + original_indent_width.saturating_sub(min_prefix_space_width); - let new_indent = Indent::from_width(context.config, new_indent_width); - format!("{}{}", new_indent.to_string(context.config), line.trim()) - } - None => String::new(), - }, - ).collect::>() - .join("\n"), + first_line + "\n" + &trimmed_lines + .iter() + .map( + |&(trimmed, ref line, prefix_space_width)| match prefix_space_width { + _ if !trimmed => line.to_owned(), + Some(original_indent_width) => { + let new_indent_width = indent.width() + original_indent_width + .saturating_sub(min_prefix_space_width); + let new_indent = Indent::from_width(context.config, new_indent_width); + format!("{}{}", new_indent.to_string(context.config), line.trim()) + } + None => String::new(), + }, + ).collect::>() + .join("\n"), ) } diff --git a/src/pairs.rs b/src/pairs.rs index 2c4358f7278a..17b869750226 100644 --- a/src/pairs.rs +++ b/src/pairs.rs @@ -125,7 +125,7 @@ fn rewrite_pairs_multiline( IndentStyle::Visual => shape.visual_indent(0), IndentStyle::Block => shape.block_indent(context.config.tab_spaces()), }).with_max_width(&context.config) - .sub_width(rhs_offset)?; + .sub_width(rhs_offset)?; let indent_str = nested_shape.indent.to_string_with_newline(context.config); let mut result = String::new(); diff --git a/src/reorder.rs b/src/reorder.rs index df32ab47b2fd..48ddd1163379 100644 --- a/src/reorder.rs +++ b/src/reorder.rs @@ -241,12 +241,13 @@ impl<'b, 'a: 'b> FmtVisitor<'a> { let item_length = items .iter() .take_while(|ppi| { - item_kind.is_same_item_kind(&***ppi) && (!in_group || { - let current = self.codemap.lookup_line_range(ppi.span()); - let in_same_group = current.lo < last.hi + 2; - last = current; - in_same_group - }) + item_kind.is_same_item_kind(&***ppi) + && (!in_group || { + let current = self.codemap.lookup_line_range(ppi.span()); + let in_same_group = current.lo < last.hi + 2; + last = current; + in_same_group + }) }).count(); let items = &items[..item_length];