File tree Expand file tree Collapse file tree 6 files changed +27
-27
lines changed Expand file tree Collapse file tree 6 files changed +27
-27
lines changed Original file line number Diff line number Diff line change @@ -302,7 +302,7 @@ trait ChainFormatter {
302
302
// foo.bar
303
303
// .baz()
304
304
// ```
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'.
306
306
fn format_root (
307
307
& mut self ,
308
308
parent : & ChainItem ,
Original file line number Diff line number Diff line change @@ -376,7 +376,8 @@ where
376
376
ast:: ExprKind :: Closure ( ..) => true ,
377
377
_ => false ,
378
378
} ) . unwrap_or ( false )
379
- } ) . count ( ) > 1
379
+ } ) . count ( )
380
+ > 1
380
381
}
381
382
382
383
fn is_block_closure_forced ( context : & RewriteContext , expr : & ast:: Expr ) -> bool {
Original file line number Diff line number Diff line change @@ -246,8 +246,7 @@ impl FormattingError {
246
246
fl. file
247
247
. get_line ( fl. lines [ 0 ] . line_index )
248
248
. map ( |l| l. into_owned ( ) )
249
- } )
250
- . unwrap_or_else ( || String :: new ( ) ) ,
249
+ } ) . unwrap_or_else ( || String :: new ( ) ) ,
251
250
}
252
251
}
253
252
Original file line number Diff line number Diff line change @@ -1118,22 +1118,21 @@ fn indent_macro_snippet(
1118
1118
} ) . min ( ) ?;
1119
1119
1120
1120
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 " ) ,
1137
1136
)
1138
1137
}
1139
1138
Original file line number Diff line number Diff line change @@ -125,7 +125,7 @@ fn rewrite_pairs_multiline<T: Rewrite>(
125
125
IndentStyle :: Visual => shape. visual_indent ( 0 ) ,
126
126
IndentStyle :: Block => shape. block_indent ( context. config . tab_spaces ( ) ) ,
127
127
} ) . with_max_width ( & context. config )
128
- . sub_width ( rhs_offset) ?;
128
+ . sub_width ( rhs_offset) ?;
129
129
130
130
let indent_str = nested_shape. indent . to_string_with_newline ( context. config ) ;
131
131
let mut result = String :: new ( ) ;
Original file line number Diff line number Diff line change @@ -241,12 +241,13 @@ impl<'b, 'a: 'b> FmtVisitor<'a> {
241
241
let item_length = items
242
242
. iter ( )
243
243
. 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
+ } )
250
251
} ) . count ( ) ;
251
252
let items = & items[ ..item_length] ;
252
253
You can’t perform that action at this time.
0 commit comments