@@ -52,8 +52,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MapClone {
5252 if args. len( ) == 2 ;
5353 if method. ident. as_str( ) == "map" ;
5454 let ty = cx. tables. expr_ty( & args[ 0 ] ) ;
55- let is_option = match_type( cx, ty, & paths:: OPTION ) ;
56- if is_option || match_trait_method( cx, e, & paths:: ITERATOR ) ;
55+ if match_type( cx, ty, & paths:: OPTION ) || match_trait_method( cx, e, & paths:: ITERATOR ) ;
5756 if let hir:: ExprKind :: Closure ( _, _, body_id, _, _) = args[ 1 ] . node;
5857 let closure_body = cx. tcx. hir( ) . body( body_id) ;
5958 let closure_expr = remove_blocks( & closure_body. value) ;
@@ -63,16 +62,14 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MapClone {
6362 hir:: BindingAnnotation :: Unannotated , .., name, None
6463 ) = inner. node {
6564 if ident_eq( name, closure_expr) {
66- // FIXME When Iterator::copied() stabilizes we can remove is_option
67- // from here and the other lint() calls
68- lint( cx, e. span, args[ 0 ] . span, is_option) ;
65+ lint( cx, e. span, args[ 0 ] . span, true ) ;
6966 }
7067 } ,
7168 hir:: PatKind :: Binding ( hir:: BindingAnnotation :: Unannotated , .., name, None ) => {
7269 match closure_expr. node {
7370 hir:: ExprKind :: Unary ( hir:: UnOp :: UnDeref , ref inner) => {
7471 if ident_eq( name, inner) && !cx. tables. expr_ty( inner) . is_box( ) {
75- lint( cx, e. span, args[ 0 ] . span, is_option ) ;
72+ lint( cx, e. span, args[ 0 ] . span, true ) ;
7673 }
7774 } ,
7875 hir:: ExprKind :: MethodCall ( ref method, _, ref obj) => {
@@ -82,7 +79,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MapClone {
8279 let obj_ty = cx. tables. expr_ty( & obj[ 0 ] ) ;
8380 if let ty:: Ref ( _, ty, _) = obj_ty. sty {
8481 let copy = is_copy( cx, ty) ;
85- lint( cx, e. span, args[ 0 ] . span, is_option && copy) ;
82+ lint( cx, e. span, args[ 0 ] . span, copy) ;
8683 } else {
8784 lint_needless_cloning( cx, e. span, args[ 0 ] . span) ;
8885 }
0 commit comments