@@ -244,7 +244,6 @@ fn ident_difference(left: &Expr, right: &Expr) -> IdentDifference {
244
244
fn get_ident ( expr : & Expr , location : IdentLocation ) -> Option < Ident > {
245
245
IdentIter :: new ( expr)
246
246
. nth ( location. index )
247
- . map ( |( ident, _) | ident)
248
247
}
249
248
250
249
fn suggestion_with_swapped_ident (
@@ -254,22 +253,21 @@ fn suggestion_with_swapped_ident(
254
253
ident : Ident ,
255
254
applicability : & mut Applicability ,
256
255
) -> Option < String > {
257
- IdentIter :: new ( expr)
258
- . nth ( location. index )
259
- . map ( |( current_ident, current_expr) | {
256
+ get_ident ( expr, location)
257
+ . map ( |current_ident| {
260
258
format ! (
261
259
"{}{}{}" ,
262
260
snippet_with_applicability(
263
261
cx,
264
- current_expr . span
262
+ expr . span
265
263
. with_hi( current_ident. span. lo( ) ) ,
266
264
".." ,
267
265
applicability
268
266
) ,
269
267
current_ident. to_string( ) ,
270
268
snippet_with_applicability(
271
269
cx,
272
- current_expr . span
270
+ expr . span
273
271
. with_lo( current_ident. span. hi( ) ) ,
274
272
".." ,
275
273
applicability
@@ -302,7 +300,7 @@ impl <'expr> IdentIter<'expr> {
302
300
}
303
301
304
302
impl < ' expr > Iterator for IdentIter < ' expr > {
305
- type Item = ( Ident , & ' expr Expr ) ;
303
+ type Item = Ident ;
306
304
307
305
fn next ( & mut self ) -> Option < Self :: Item > {
308
306
if self . done {
@@ -336,11 +334,9 @@ impl <'expr> Iterator for IdentIter<'expr> {
336
334
ExprKind :: Lit ( _) |ExprKind :: Err => None ,
337
335
ExprKind :: Path ( _, ref path)
338
336
| ExprKind :: MacCall ( MacCall { ref path, ..} ) => {
339
- let current_expr: & ' expr Expr = self . expr ;
340
-
341
337
set_and_call_next ! (
342
338
path. segments. iter( )
343
- . map( move |s| ( s. ident, current_expr ) )
339
+ . map( |s| s. ident)
344
340
)
345
341
} ,
346
342
ExprKind :: Box ( ref expr)
@@ -365,10 +361,8 @@ impl <'expr> Iterator for IdentIter<'expr> {
365
361
)
366
362
} ,
367
363
ExprKind :: MethodCall ( ref method_name, ref args, _) => {
368
- let current_expr: & ' expr Expr = self . expr ;
369
-
370
364
set_and_call_next ! (
371
- iter:: once( ( method_name. ident, current_expr ) )
365
+ iter:: once( method_name. ident)
372
366
. chain(
373
367
args. iter( )
374
368
. flat_map( IdentIter :: new_p)
0 commit comments