@@ -298,7 +298,7 @@ pub fn rewrite_array<'a, I>(expr_iter: I,
298
298
|item| item. span . lo ,
299
299
|item| item. span . hi ,
300
300
// 1 = [
301
- |item| item. rewrite ( & inner_context, max_item_width, offset) ,
301
+ |item| item. rewrite ( inner_context, max_item_width, offset) ,
302
302
span. lo ,
303
303
span. hi )
304
304
. collect :: < Vec < _ > > ( ) ;
@@ -493,7 +493,7 @@ fn and_one_line(x: Option<String>) -> Option<String> {
493
493
494
494
fn nop_block_collapse ( block_str : Option < String > , budget : usize ) -> Option < String > {
495
495
block_str. map ( |block_str| {
496
- if block_str. starts_with ( "{" ) && budget >= 2 &&
496
+ if block_str. starts_with ( '{' ) && budget >= 2 &&
497
497
( block_str[ 1 ..] . find ( |c : char | !c. is_whitespace ( ) ) . unwrap ( ) == block_str. len ( ) - 2 ) {
498
498
"{}" . to_owned ( )
499
499
} else {
@@ -772,7 +772,7 @@ fn rewrite_if_else(context: &RewriteContext,
772
772
pat. map_or ( cond. span . lo ,
773
773
|_| context. codemap . span_before ( span, "let" ) ) ) ;
774
774
775
- let between_if_cond_comment = extract_comment ( between_if_cond, & context, offset, width) ;
775
+ let between_if_cond_comment = extract_comment ( between_if_cond, context, offset, width) ;
776
776
777
777
let after_cond_comment = extract_comment ( mk_sp ( cond. span . hi , if_block. span . lo ) ,
778
778
context,
@@ -831,13 +831,13 @@ fn rewrite_if_else(context: &RewriteContext,
831
831
mk_sp ( if_block. span . hi ,
832
832
context. codemap . span_before ( mk_sp ( if_block. span . hi , else_block. span . lo ) , "else" ) ) ;
833
833
let between_if_else_block_comment =
834
- extract_comment ( between_if_else_block, & context, offset, width) ;
834
+ extract_comment ( between_if_else_block, context, offset, width) ;
835
835
836
836
let after_else = mk_sp ( context. codemap
837
837
. span_after ( mk_sp ( if_block. span . hi , else_block. span . lo ) ,
838
838
"else" ) ,
839
839
else_block. span . lo ) ;
840
- let after_else_comment = extract_comment ( after_else, & context, offset, width) ;
840
+ let after_else_comment = extract_comment ( after_else, context, offset, width) ;
841
841
842
842
let between_sep = match context. config . else_if_brace_style {
843
843
ElseIfBraceStyle :: AlwaysNextLine |
@@ -854,7 +854,7 @@ fn rewrite_if_else(context: &RewriteContext,
854
854
. map_or( between_sep, |str | & * * str ) ,
855
855
after_else_comment. as_ref( ) . map_or( after_sep, |str | & * * str ) )
856
856
. ok( ) ) ;
857
- result. push_str ( & & try_opt ! ( rewrite) ) ;
857
+ result. push_str ( & try_opt ! ( rewrite) ) ;
858
858
}
859
859
860
860
Some ( result)
@@ -1021,7 +1021,7 @@ fn rewrite_match(context: &RewriteContext,
1021
1021
// We couldn't format the arm, just reproduce the source.
1022
1022
let snippet = context. snippet ( mk_sp ( arm_start_pos ( arm) , arm_end_pos ( arm) ) ) ;
1023
1023
result. push_str ( & snippet) ;
1024
- result. push_str ( arm_comma ( & context. config , & arm, & arm. body ) ) ;
1024
+ result. push_str ( arm_comma ( context. config , arm, & arm. body ) ) ;
1025
1025
}
1026
1026
}
1027
1027
// BytePos(1) = closing match brace.
@@ -1102,7 +1102,7 @@ impl Rewrite for ast::Arm {
1102
1102
. map( |p| p. rewrite( context, pat_budget, offset) )
1103
1103
. collect:: <Option <Vec <_>>>( ) ) ;
1104
1104
1105
- let all_simple = pat_strs. iter ( ) . all ( |p| pat_is_simple ( & p) ) ;
1105
+ let all_simple = pat_strs. iter ( ) . all ( |p| pat_is_simple ( p) ) ;
1106
1106
let items: Vec < _ > = pat_strs. into_iter ( ) . map ( ListItem :: from_str) . collect ( ) ;
1107
1107
let fmt = ListFormatting {
1108
1108
tactic : if all_simple {
@@ -1145,7 +1145,7 @@ impl Rewrite for ast::Arm {
1145
1145
ref x => x,
1146
1146
} ;
1147
1147
1148
- let comma = arm_comma ( & context. config , self , body) ;
1148
+ let comma = arm_comma ( context. config , self , body) ;
1149
1149
let alt_block_sep = String :: from ( "\n " ) + & context. block_indent . to_string ( context. config ) ;
1150
1150
1151
1151
// Let's try and get the arm body on the same line as the condition.
@@ -1305,7 +1305,7 @@ fn rewrite_pat_expr(context: &RewriteContext,
1305
1305
expr. rewrite ( context,
1306
1306
try_opt ! ( context. config. max_width. checked_sub( pat_offset. width( ) ) ) ,
1307
1307
pat_offset) ;
1308
- result. push_str ( & & try_opt ! ( expr_rewrite) ) ;
1308
+ result. push_str ( & try_opt ! ( expr_rewrite) ) ;
1309
1309
1310
1310
Some ( result)
1311
1311
}
@@ -1433,7 +1433,7 @@ fn rewrite_call_inner<R>(context: &RewriteContext,
1433
1433
")" ,
1434
1434
|item| item. span . lo ,
1435
1435
|item| item. span . hi ,
1436
- |item| item. rewrite ( & inner_context, remaining_width, offset) ,
1436
+ |item| item. rewrite ( inner_context, remaining_width, offset) ,
1437
1437
span. lo ,
1438
1438
span. hi ) ;
1439
1439
let mut item_vec: Vec < _ > = items. collect ( ) ;
@@ -1454,7 +1454,7 @@ fn rewrite_call_inner<R>(context: &RewriteContext,
1454
1454
// first arguments.
1455
1455
if overflow_last {
1456
1456
let inner_context = & RewriteContext { block_indent : context. block_indent , ..* context } ;
1457
- let rewrite = args. last ( ) . unwrap ( ) . rewrite ( & inner_context, remaining_width, offset) ;
1457
+ let rewrite = args. last ( ) . unwrap ( ) . rewrite ( inner_context, remaining_width, offset) ;
1458
1458
1459
1459
if let Some ( rewrite) = rewrite {
1460
1460
let rewrite_first_line = Some ( rewrite[ ..first_line_width ( & rewrite) ] . to_owned ( ) ) ;
@@ -1557,8 +1557,8 @@ fn rewrite_struct_lit<'a>(context: &RewriteContext,
1557
1557
"}" ,
1558
1558
|item| {
1559
1559
match * item {
1560
- StructLitField :: Regular ( ref field) => field. span . lo ,
1561
- StructLitField :: Base ( ref expr) => {
1560
+ StructLitField :: Regular ( field) => field. span . lo ,
1561
+ StructLitField :: Base ( expr) => {
1562
1562
let last_field_hi = fields. last ( ) . map_or ( span. lo , |field| field. span . hi ) ;
1563
1563
let snippet = context. snippet ( mk_sp ( last_field_hi, expr. span . lo ) ) ;
1564
1564
let pos = snippet. find_uncommented ( ".." ) . unwrap ( ) ;
@@ -1568,19 +1568,19 @@ fn rewrite_struct_lit<'a>(context: &RewriteContext,
1568
1568
} ,
1569
1569
|item| {
1570
1570
match * item {
1571
- StructLitField :: Regular ( ref field) => field. span . hi ,
1572
- StructLitField :: Base ( ref expr) => expr. span . hi ,
1571
+ StructLitField :: Regular ( field) => field. span . hi ,
1572
+ StructLitField :: Base ( expr) => expr. span . hi ,
1573
1573
}
1574
1574
} ,
1575
1575
|item| {
1576
1576
match * item {
1577
- StructLitField :: Regular ( ref field) => {
1577
+ StructLitField :: Regular ( field) => {
1578
1578
rewrite_field ( inner_context,
1579
- & field,
1579
+ field,
1580
1580
v_budget. checked_sub ( 1 ) . unwrap_or ( 0 ) ,
1581
1581
indent)
1582
1582
}
1583
- StructLitField :: Base ( ref expr) => {
1583
+ StructLitField :: Base ( expr) => {
1584
1584
// 2 = ..
1585
1585
expr. rewrite ( inner_context, try_opt ! ( v_budget. checked_sub( 2 ) ) , indent + 2 )
1586
1586
. map ( |s| format ! ( "..{}" , s) )
@@ -1678,7 +1678,7 @@ fn rewrite_field(context: &RewriteContext,
1678
1678
match expr {
1679
1679
Some ( e) => Some ( format ! ( "{}{}{}" , name, separator, e) ) ,
1680
1680
None => {
1681
- let expr_offset = offset. block_indent ( & context. config ) ;
1681
+ let expr_offset = offset. block_indent ( context. config ) ;
1682
1682
let expr = field. expr . rewrite ( context,
1683
1683
try_opt ! ( context. config
1684
1684
. max_width
@@ -1843,7 +1843,7 @@ fn rewrite_assignment(context: &RewriteContext,
1843
1843
try_opt!( lhs. rewrite( context, max_width, offset) ) ,
1844
1844
operator_str) ;
1845
1845
1846
- rewrite_assign_rhs ( & context, lhs_str, rhs, width, offset)
1846
+ rewrite_assign_rhs ( context, lhs_str, rhs, width, offset)
1847
1847
}
1848
1848
1849
1849
// The left hand side must contain everything up to, and including, the
@@ -1863,7 +1863,7 @@ pub fn rewrite_assign_rhs<S: Into<String>>(context: &RewriteContext,
1863
1863
} ;
1864
1864
// 1 = space between operator and rhs.
1865
1865
let max_width = try_opt ! ( width. checked_sub( last_line_width + 1 ) ) ;
1866
- let rhs = ex. rewrite ( & context, max_width, offset + last_line_width + 1 ) ;
1866
+ let rhs = ex. rewrite ( context, max_width, offset + last_line_width + 1 ) ;
1867
1867
1868
1868
fn count_line_breaks ( src : & str ) -> usize {
1869
1869
src. chars ( ) . filter ( |& x| x == '\n' ) . count ( )
0 commit comments