@@ -110,11 +110,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EqOp {
110110 OP_REF ,
111111 e. span ,
112112 "needlessly taken reference of both operands" ,
113- |db | {
113+ |diag | {
114114 let lsnip = snippet ( cx, l. span , "..." ) . to_string ( ) ;
115115 let rsnip = snippet ( cx, r. span , "..." ) . to_string ( ) ;
116116 multispan_sugg (
117- db ,
117+ diag ,
118118 "use the values directly" . to_string ( ) ,
119119 vec ! [ ( left. span, lsnip) , ( right. span, rsnip) ] ,
120120 ) ;
@@ -124,15 +124,21 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EqOp {
124124 && !rcpy
125125 && implements_trait ( cx, lty, trait_id, & [ cx. tables . expr_ty ( right) . into ( ) ] )
126126 {
127- span_lint_and_then ( cx, OP_REF , e. span , "needlessly taken reference of left operand" , |db| {
128- let lsnip = snippet ( cx, l. span , "..." ) . to_string ( ) ;
129- db. span_suggestion (
130- left. span ,
131- "use the left value directly" ,
132- lsnip,
133- Applicability :: MaybeIncorrect , // FIXME #2597
134- ) ;
135- } )
127+ span_lint_and_then (
128+ cx,
129+ OP_REF ,
130+ e. span ,
131+ "needlessly taken reference of left operand" ,
132+ |diag| {
133+ let lsnip = snippet ( cx, l. span , "..." ) . to_string ( ) ;
134+ diag. span_suggestion (
135+ left. span ,
136+ "use the left value directly" ,
137+ lsnip,
138+ Applicability :: MaybeIncorrect , // FIXME #2597
139+ ) ;
140+ } ,
141+ )
136142 } else if !lcpy
137143 && rcpy
138144 && implements_trait ( cx, cx. tables . expr_ty ( left) , trait_id, & [ rty. into ( ) ] )
@@ -142,9 +148,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EqOp {
142148 OP_REF ,
143149 e. span ,
144150 "needlessly taken reference of right operand" ,
145- |db | {
151+ |diag | {
146152 let rsnip = snippet ( cx, r. span , "..." ) . to_string ( ) ;
147- db . span_suggestion (
153+ diag . span_suggestion (
148154 right. span ,
149155 "use the right value directly" ,
150156 rsnip,
@@ -161,15 +167,21 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EqOp {
161167 if ( requires_ref || lcpy)
162168 && implements_trait ( cx, lty, trait_id, & [ cx. tables . expr_ty ( right) . into ( ) ] )
163169 {
164- span_lint_and_then ( cx, OP_REF , e. span , "needlessly taken reference of left operand" , |db| {
165- let lsnip = snippet ( cx, l. span , "..." ) . to_string ( ) ;
166- db. span_suggestion (
167- left. span ,
168- "use the left value directly" ,
169- lsnip,
170- Applicability :: MaybeIncorrect , // FIXME #2597
171- ) ;
172- } )
170+ span_lint_and_then (
171+ cx,
172+ OP_REF ,
173+ e. span ,
174+ "needlessly taken reference of left operand" ,
175+ |diag| {
176+ let lsnip = snippet ( cx, l. span , "..." ) . to_string ( ) ;
177+ diag. span_suggestion (
178+ left. span ,
179+ "use the left value directly" ,
180+ lsnip,
181+ Applicability :: MaybeIncorrect , // FIXME #2597
182+ ) ;
183+ } ,
184+ )
173185 }
174186 } ,
175187 // foo == &bar
@@ -179,9 +191,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EqOp {
179191 if ( requires_ref || rcpy)
180192 && implements_trait ( cx, cx. tables . expr_ty ( left) , trait_id, & [ rty. into ( ) ] )
181193 {
182- span_lint_and_then ( cx, OP_REF , e. span , "taken reference of right operand" , |db | {
194+ span_lint_and_then ( cx, OP_REF , e. span , "taken reference of right operand" , |diag | {
183195 let rsnip = snippet ( cx, r. span , "..." ) . to_string ( ) ;
184- db . span_suggestion (
196+ diag . span_suggestion (
185197 right. span ,
186198 "use the right value directly" ,
187199 rsnip,
0 commit comments