@@ -370,9 +370,9 @@ impl LateLintPass for Pass {
370
370
& ExprMethodCall ( method_name, _, ref method_args) ) = ( pat, & match_expr. node ) {
371
371
let iter_expr = & method_args[ 0 ] ;
372
372
if let Some ( lhs_constructor) = path. segments . last ( ) {
373
- if method_name. node . as_str ( ) == "next" &&
373
+ if & * method_name. node . as_str ( ) == "next" &&
374
374
match_trait_method ( cx, match_expr, & paths:: ITERATOR ) &&
375
- lhs_constructor. name . as_str ( ) == "Some" &&
375
+ & * lhs_constructor. name . as_str ( ) == "Some" &&
376
376
!is_refutable ( cx, & pat_args[ 0 ] ) &&
377
377
!is_iterator_used_after_while_let ( cx, iter_expr) {
378
378
let iterator = snippet ( cx, method_args[ 0 ] . span , "_" ) ;
@@ -395,7 +395,7 @@ impl LateLintPass for Pass {
395
395
fn check_stmt ( & mut self , cx : & LateContext , stmt : & Stmt ) {
396
396
if let StmtSemi ( ref expr, _) = stmt. node {
397
397
if let ExprMethodCall ( ref method, _, ref args) = expr. node {
398
- if args. len ( ) == 1 && method. node . as_str ( ) == "collect" &&
398
+ if args. len ( ) == 1 && & * method. node . as_str ( ) == "collect" &&
399
399
match_trait_method ( cx, expr, & paths:: ITERATOR ) {
400
400
span_lint ( cx,
401
401
UNUSED_COLLECT ,
@@ -509,7 +509,7 @@ fn is_len_call(expr: &Expr, var: &Name) -> bool {
509
509
if_let_chain ! { [
510
510
let ExprMethodCall ( method, _, ref len_args) = expr. node,
511
511
len_args. len( ) == 1 ,
512
- method. node. as_str( ) == "len" ,
512
+ & * method. node. as_str( ) == "len" ,
513
513
let ExprPath ( _, ref path) = len_args[ 0 ] . node,
514
514
path. segments. len( ) == 1 ,
515
515
& path. segments[ 0 ] . name == var
@@ -580,14 +580,14 @@ fn check_for_loop_arg(cx: &LateContext, pat: &Pat, arg: &Expr, expr: &Expr) {
580
580
if args. len ( ) == 1 {
581
581
let method_name = method. node ;
582
582
// check for looping over x.iter() or x.iter_mut(), could use &x or &mut x
583
- if method_name. as_str ( ) == "iter" || method_name. as_str ( ) == "iter_mut" {
583
+ if & * method_name. as_str ( ) == "iter" || & * method_name. as_str ( ) == "iter_mut" {
584
584
if is_ref_iterable_type ( cx, & args[ 0 ] ) {
585
585
let object = snippet ( cx, args[ 0 ] . span , "_" ) ;
586
586
span_lint ( cx,
587
587
EXPLICIT_ITER_LOOP ,
588
588
expr. span ,
589
589
& format ! ( "it is more idiomatic to loop over `&{}{}` instead of `{}.{}()`" ,
590
- if method_name. as_str( ) == "iter_mut" {
590
+ if & * method_name. as_str( ) == "iter_mut" {
591
591
"mut "
592
592
} else {
593
593
""
@@ -596,7 +596,7 @@ fn check_for_loop_arg(cx: &LateContext, pat: &Pat, arg: &Expr, expr: &Expr) {
596
596
object,
597
597
method_name) ) ;
598
598
}
599
- } else if method_name. as_str ( ) == "into_iter" && match_trait_method ( cx, arg, & paths:: INTO_ITERATOR ) {
599
+ } else if & * method_name. as_str ( ) == "into_iter" && match_trait_method ( cx, arg, & paths:: INTO_ITERATOR ) {
600
600
let object = snippet ( cx, args[ 0 ] . span , "_" ) ;
601
601
span_lint ( cx,
602
602
EXPLICIT_INTO_ITER_LOOP ,
@@ -606,7 +606,7 @@ fn check_for_loop_arg(cx: &LateContext, pat: &Pat, arg: &Expr, expr: &Expr) {
606
606
object,
607
607
method_name) ) ;
608
608
609
- } else if method_name. as_str ( ) == "next" && match_trait_method ( cx, arg, & paths:: ITERATOR ) {
609
+ } else if & * method_name. as_str ( ) == "next" && match_trait_method ( cx, arg, & paths:: ITERATOR ) {
610
610
span_lint ( cx,
611
611
ITER_NEXT_LOOP ,
612
612
expr. span ,
0 commit comments