@@ -389,8 +389,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
389
389
& ExprMethodCall ( method_name, _, ref method_args) ) = ( pat, & match_expr. node ) {
390
390
let iter_expr = & method_args[ 0 ] ;
391
391
let lhs_constructor = last_path_segment ( qpath) ;
392
- if & * method_name. node . as_str ( ) == "next" && match_trait_method ( cx, match_expr, & paths:: ITERATOR ) &&
393
- & * lhs_constructor. name . as_str ( ) == "Some" && !is_refutable ( cx, & pat_args[ 0 ] ) &&
392
+ if method_name. node == "next" && match_trait_method ( cx, match_expr, & paths:: ITERATOR ) &&
393
+ lhs_constructor. name == "Some" && !is_refutable ( cx, & pat_args[ 0 ] ) &&
394
394
!is_iterator_used_after_while_let ( cx, iter_expr) {
395
395
let iterator = snippet ( cx, method_args[ 0 ] . span , "_" ) ;
396
396
let loop_var = snippet ( cx, pat_args[ 0 ] . span , "_" ) ;
@@ -409,7 +409,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
409
409
fn check_stmt ( & mut self , cx : & LateContext < ' a , ' tcx > , stmt : & ' tcx Stmt ) {
410
410
if let StmtSemi ( ref expr, _) = stmt. node {
411
411
if let ExprMethodCall ( ref method, _, ref args) = expr. node {
412
- if args. len ( ) == 1 && & * method. node . as_str ( ) == "collect" &&
412
+ if args. len ( ) == 1 && method. node == "collect" &&
413
413
match_trait_method ( cx, expr, & paths:: ITERATOR ) {
414
414
span_lint ( cx,
415
415
UNUSED_COLLECT ,
@@ -579,10 +579,10 @@ fn is_len_call(expr: &Expr, var: &Name) -> bool {
579
579
if_let_chain ! { [
580
580
let ExprMethodCall ( method, _, ref len_args) = expr. node,
581
581
len_args. len( ) == 1 ,
582
- & * method. node. as_str ( ) == "len" ,
582
+ method. node == "len" ,
583
583
let ExprPath ( QPath :: Resolved ( _, ref path) ) = len_args[ 0 ] . node,
584
584
path. segments. len( ) == 1 ,
585
- & path. segments[ 0 ] . name == var
585
+ path. segments[ 0 ] . name == * var
586
586
] , {
587
587
return true ;
588
588
} }
@@ -664,11 +664,11 @@ fn check_for_loop_arg(cx: &LateContext, pat: &Pat, arg: &Expr, expr: &Expr) {
664
664
if let ExprMethodCall ( ref method, _, ref args) = arg. node {
665
665
// just the receiver, no arguments
666
666
if args. len ( ) == 1 {
667
- let method_name = & * method. node . as_str ( ) ;
667
+ let method_name = method. node . as_str ( ) ;
668
668
// check for looping over x.iter() or x.iter_mut(), could use &x or &mut x
669
669
if method_name == "iter" || method_name == "iter_mut" {
670
670
if is_ref_iterable_type ( cx, & args[ 0 ] ) {
671
- lint_iter_method ( cx, args, arg, method_name) ;
671
+ lint_iter_method ( cx, args, arg, & method_name) ;
672
672
}
673
673
} else if method_name == "into_iter" && match_trait_method ( cx, arg, & paths:: INTO_ITERATOR ) {
674
674
let method_call = ty:: MethodCall :: expr ( arg. id ) ;
@@ -680,7 +680,7 @@ fn check_for_loop_arg(cx: &LateContext, pat: &Pat, arg: &Expr, expr: &Expr) {
680
680
let fn_arg_tys = fn_ty. fn_args ( ) ;
681
681
assert_eq ! ( fn_arg_tys. skip_binder( ) . len( ) , 1 ) ;
682
682
if fn_arg_tys. skip_binder ( ) [ 0 ] . is_region_ptr ( ) {
683
- lint_iter_method ( cx, args, arg, method_name) ;
683
+ lint_iter_method ( cx, args, arg, & method_name) ;
684
684
} else {
685
685
let object = snippet ( cx, args[ 0 ] . span , "_" ) ;
686
686
span_lint_and_sugg ( cx,
0 commit comments