@@ -110,11 +110,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EqOp {
110
110
OP_REF ,
111
111
e. span ,
112
112
"needlessly taken reference of both operands" ,
113
- |db | {
113
+ |diag | {
114
114
let lsnip = snippet ( cx, l. span , "..." ) . to_string ( ) ;
115
115
let rsnip = snippet ( cx, r. span , "..." ) . to_string ( ) ;
116
116
multispan_sugg (
117
- db ,
117
+ diag ,
118
118
"use the values directly" . to_string ( ) ,
119
119
vec ! [ ( left. span, lsnip) , ( right. span, rsnip) ] ,
120
120
) ;
@@ -124,15 +124,21 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EqOp {
124
124
&& !rcpy
125
125
&& implements_trait ( cx, lty, trait_id, & [ cx. tables . expr_ty ( right) . into ( ) ] )
126
126
{
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
+ )
136
142
} else if !lcpy
137
143
&& rcpy
138
144
&& implements_trait ( cx, cx. tables . expr_ty ( left) , trait_id, & [ rty. into ( ) ] )
@@ -142,9 +148,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EqOp {
142
148
OP_REF ,
143
149
e. span ,
144
150
"needlessly taken reference of right operand" ,
145
- |db | {
151
+ |diag | {
146
152
let rsnip = snippet ( cx, r. span , "..." ) . to_string ( ) ;
147
- db . span_suggestion (
153
+ diag . span_suggestion (
148
154
right. span ,
149
155
"use the right value directly" ,
150
156
rsnip,
@@ -161,15 +167,21 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EqOp {
161
167
if ( requires_ref || lcpy)
162
168
&& implements_trait ( cx, lty, trait_id, & [ cx. tables . expr_ty ( right) . into ( ) ] )
163
169
{
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
+ )
173
185
}
174
186
} ,
175
187
// foo == &bar
@@ -179,9 +191,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EqOp {
179
191
if ( requires_ref || rcpy)
180
192
&& implements_trait ( cx, cx. tables . expr_ty ( left) , trait_id, & [ rty. into ( ) ] )
181
193
{
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 | {
183
195
let rsnip = snippet ( cx, r. span , "..." ) . to_string ( ) ;
184
- db . span_suggestion (
196
+ diag . span_suggestion (
185
197
right. span ,
186
198
"use the right value directly" ,
187
199
rsnip,
0 commit comments