Skip to content

Commit df4fb8a

Browse files
committed
Reformatting after rebase
1 parent dcf9f61 commit df4fb8a

File tree

6 files changed

+27
-27
lines changed

6 files changed

+27
-27
lines changed

src/chains.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ trait ChainFormatter {
302302
// foo.bar
303303
// .baz()
304304
// ```
305-
// If `bar` were not part of the root, then baz would be orphaned and 'float'.
305+
// If `bar` were not part of the root, then foo would be orphaned and 'float'.
306306
fn format_root(
307307
&mut self,
308308
parent: &ChainItem,

src/closures.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,8 @@ where
376376
ast::ExprKind::Closure(..) => true,
377377
_ => false,
378378
}).unwrap_or(false)
379-
}).count() > 1
379+
}).count()
380+
> 1
380381
}
381382

382383
fn is_block_closure_forced(context: &RewriteContext, expr: &ast::Expr) -> bool {

src/formatting.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,7 @@ impl FormattingError {
246246
fl.file
247247
.get_line(fl.lines[0].line_index)
248248
.map(|l| l.into_owned())
249-
})
250-
.unwrap_or_else(|| String::new()),
249+
}).unwrap_or_else(|| String::new()),
251250
}
252251
}
253252

src/macros.rs

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,22 +1118,21 @@ fn indent_macro_snippet(
11181118
}).min()?;
11191119

11201120
Some(
1121-
first_line + "\n"
1122-
+ &trimmed_lines
1123-
.iter()
1124-
.map(
1125-
|&(trimmed, ref line, prefix_space_width)| match prefix_space_width {
1126-
_ if !trimmed => line.to_owned(),
1127-
Some(original_indent_width) => {
1128-
let new_indent_width = indent.width()
1129-
+ original_indent_width.saturating_sub(min_prefix_space_width);
1130-
let new_indent = Indent::from_width(context.config, new_indent_width);
1131-
format!("{}{}", new_indent.to_string(context.config), line.trim())
1132-
}
1133-
None => String::new(),
1134-
},
1135-
).collect::<Vec<_>>()
1136-
.join("\n"),
1121+
first_line + "\n" + &trimmed_lines
1122+
.iter()
1123+
.map(
1124+
|&(trimmed, ref line, prefix_space_width)| match prefix_space_width {
1125+
_ if !trimmed => line.to_owned(),
1126+
Some(original_indent_width) => {
1127+
let new_indent_width = indent.width() + original_indent_width
1128+
.saturating_sub(min_prefix_space_width);
1129+
let new_indent = Indent::from_width(context.config, new_indent_width);
1130+
format!("{}{}", new_indent.to_string(context.config), line.trim())
1131+
}
1132+
None => String::new(),
1133+
},
1134+
).collect::<Vec<_>>()
1135+
.join("\n"),
11371136
)
11381137
}
11391138

src/pairs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ fn rewrite_pairs_multiline<T: Rewrite>(
125125
IndentStyle::Visual => shape.visual_indent(0),
126126
IndentStyle::Block => shape.block_indent(context.config.tab_spaces()),
127127
}).with_max_width(&context.config)
128-
.sub_width(rhs_offset)?;
128+
.sub_width(rhs_offset)?;
129129

130130
let indent_str = nested_shape.indent.to_string_with_newline(context.config);
131131
let mut result = String::new();

src/reorder.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -241,12 +241,13 @@ impl<'b, 'a: 'b> FmtVisitor<'a> {
241241
let item_length = items
242242
.iter()
243243
.take_while(|ppi| {
244-
item_kind.is_same_item_kind(&***ppi) && (!in_group || {
245-
let current = self.codemap.lookup_line_range(ppi.span());
246-
let in_same_group = current.lo < last.hi + 2;
247-
last = current;
248-
in_same_group
249-
})
244+
item_kind.is_same_item_kind(&***ppi)
245+
&& (!in_group || {
246+
let current = self.codemap.lookup_line_range(ppi.span());
247+
let in_same_group = current.lo < last.hi + 2;
248+
last = current;
249+
in_same_group
250+
})
250251
}).count();
251252
let items = &items[..item_length];
252253

0 commit comments

Comments
 (0)