Skip to content

Commit e3b9905

Browse files
committed
cosmetic changes
1 parent 2a85ed3 commit e3b9905

File tree

5 files changed

+7
-13
lines changed

5 files changed

+7
-13
lines changed

src/formatting/expr.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,12 +242,11 @@ pub(crate) fn format_expr(
242242
}
243243
ast::ExprKind::MacCall(ref mac) => {
244244
rewrite_macro(mac, None, context, shape, MacroPosition::Expression).or_else(|| {
245-
let m = wrap_str(
245+
wrap_str(
246246
context.snippet(expr.span).to_owned(),
247247
context.config.max_width(),
248248
shape,
249-
);
250-
m
249+
)
251250
})
252251
}
253252
ast::ExprKind::Ret(None) => Some("return".to_owned()),

src/formatting/macros.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -352,9 +352,7 @@ fn rewrite_macro_inner(
352352
return return_macro_parse_failure_fallback(context, shape.indent, mac.span());
353353
}
354354
_ if arg_vec.last().map_or(false, MacroArg::is_item) => continue,
355-
_ => {
356-
return return_macro_parse_failure_fallback(context, shape.indent, mac.span());
357-
}
355+
_ => return return_macro_parse_failure_fallback(context, shape.indent, mac.span()),
358356
}
359357

360358
parser.bump();
@@ -1300,9 +1298,7 @@ impl MacroParser {
13001298
kind: TokenKind::FatArrow,
13011299
..
13021300
}) => {}
1303-
_ => {
1304-
return None;
1305-
}
1301+
_ => return None,
13061302
}
13071303
let (mut hi, body, whole_body) = match self.toks.next()? {
13081304
TokenTree::Token(..) => return None,
@@ -1363,6 +1359,7 @@ impl MacroBranch {
13631359

13641360
// 5 = " => {"
13651361
let mut result = format_macro_args(context, self.args.clone(), shape.sub_width(5)?)?;
1362+
13661363
if multi_branch_style {
13671364
result += " =>";
13681365
}

src/formatting/missed_spans.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ impl<'a> FmtVisitor<'a> {
8181
process_last_snippet: F,
8282
) {
8383
let start = self.last_pos;
84+
8485
if start == end {
8586
// Do nothing if this is the beginning of the file.
8687
if !self.output_at_start() {

src/formatting/reorder.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,6 @@ impl<'b, 'a: 'b> FmtVisitor<'a> {
433433
// subsequent items that have the same item kind to be reordered within
434434
// `walk_reorderable_items`. Otherwise, just format the next item for output.
435435
let item_kind = ReorderableItemKind::from(items[0], self.file_mod_map);
436-
437436
if item_kind.is_reorderable(self.config) || item_kind.is_regroupable(self.config) {
438437
let visited_items_num = self.walk_reorderable_or_regroupable_items(
439438
items,

src/formatting/visitor.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ impl SnippetProvider {
5555
pub(crate) fn new(start_pos: BytePos, end_pos: BytePos, big_snippet: Rc<String>) -> Self {
5656
let start_pos = start_pos.to_usize();
5757
let end_pos = end_pos.to_usize();
58-
5958
SnippetProvider {
6059
big_snippet,
6160
start_pos,
@@ -810,6 +809,7 @@ impl<'b, 'a: 'b> FmtVisitor<'a> {
810809
}
811810
_ => (mac.span(), rewrite),
812811
};
812+
813813
self.push_rewrite(span, rewrite);
814814
}
815815

@@ -1050,15 +1050,13 @@ impl<'b, 'a: 'b> FmtVisitor<'a> {
10501050

10511051
pub(crate) fn format_separate_mod(&mut self, m: &Module<'_>, end_pos: BytePos) {
10521052
self.block_indent = Indent::empty();
1053-
10541053
let skipped = self.visit_attrs(m.attrs(), ast::AttrStyle::Inner);
10551054
assert!(
10561055
!skipped,
10571056
"Skipping module must be handled before reaching this line.",
10581057
);
10591058

10601059
self.walk_mod_items(m.as_ref());
1061-
10621060
self.format_missing_with_indent(end_pos);
10631061
}
10641062

0 commit comments

Comments
 (0)