@@ -98,17 +98,14 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EqOp {
9898 let rsnip = snippet ( cx, r. span , "..." ) . to_string ( ) ;
9999 multispan_sugg ( db,
100100 "use the values directly" . to_string ( ) ,
101- vec ! [ ( left. span, lsnip) ,
102- ( right. span, rsnip) ] ) ;
101+ vec ! [ ( left. span, lsnip) , ( right. span, rsnip) ] ) ;
103102 } )
104- } else if lcpy && !rcpy &&
105- implements_trait ( cx, lty, trait_id, & [ cx. tables . expr_ty ( right) ] ) {
103+ } else if lcpy && !rcpy && implements_trait ( cx, lty, trait_id, & [ cx. tables . expr_ty ( right) ] ) {
106104 span_lint_and_then ( cx, OP_REF , e. span , "needlessly taken reference of left operand" , |db| {
107105 let lsnip = snippet ( cx, l. span , "..." ) . to_string ( ) ;
108106 db. span_suggestion ( left. span , "use the left value directly" , lsnip) ;
109107 } )
110- } else if !lcpy && rcpy &&
111- implements_trait ( cx, cx. tables . expr_ty ( left) , trait_id, & [ rty] ) {
108+ } else if !lcpy && rcpy && implements_trait ( cx, cx. tables . expr_ty ( left) , trait_id, & [ rty] ) {
112109 span_lint_and_then ( cx,
113110 OP_REF ,
114111 e. span ,
@@ -123,8 +120,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EqOp {
123120 ( & ExprAddrOf ( _, ref l) , _) => {
124121 let lty = cx. tables . expr_ty ( l) ;
125122 let lcpy = is_copy ( cx, lty) ;
126- if ( requires_ref || lcpy) &&
127- implements_trait ( cx, lty, trait_id, & [ cx. tables . expr_ty ( right) ] ) {
123+ if ( requires_ref || lcpy) && implements_trait ( cx, lty, trait_id, & [ cx. tables . expr_ty ( right) ] ) {
128124 span_lint_and_then ( cx, OP_REF , e. span , "needlessly taken reference of left operand" , |db| {
129125 let lsnip = snippet ( cx, l. span , "..." ) . to_string ( ) ;
130126 db. span_suggestion ( left. span , "use the left value directly" , lsnip) ;
@@ -135,8 +131,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EqOp {
135131 ( _, & ExprAddrOf ( _, ref r) ) => {
136132 let rty = cx. tables . expr_ty ( r) ;
137133 let rcpy = is_copy ( cx, rty) ;
138- if ( requires_ref || rcpy) &&
139- implements_trait ( cx, cx. tables . expr_ty ( left) , trait_id, & [ rty] ) {
134+ if ( requires_ref || rcpy) && implements_trait ( cx, cx. tables . expr_ty ( left) , trait_id, & [ rty] ) {
140135 span_lint_and_then ( cx, OP_REF , e. span , "taken reference of right operand" , |db| {
141136 let rsnip = snippet ( cx, r. span , "..." ) . to_string ( ) ;
142137 db. span_suggestion ( right. span , "use the right value directly" , rsnip) ;
0 commit comments