@@ -244,7 +244,6 @@ fn ident_difference(left: &Expr, right: &Expr) -> IdentDifference {
244244fn get_ident ( expr : & Expr , location : IdentLocation ) -> Option < Ident > {
245245 IdentIter :: new ( expr)
246246 . nth ( location. index )
247- . map ( |( ident, _) | ident)
248247}
249248
250249fn suggestion_with_swapped_ident (
@@ -254,22 +253,21 @@ fn suggestion_with_swapped_ident(
254253 ident : Ident ,
255254 applicability : & mut Applicability ,
256255) -> 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| {
260258 format ! (
261259 "{}{}{}" ,
262260 snippet_with_applicability(
263261 cx,
264- current_expr . span
262+ expr . span
265263 . with_hi( current_ident. span. lo( ) ) ,
266264 ".." ,
267265 applicability
268266 ) ,
269267 current_ident. to_string( ) ,
270268 snippet_with_applicability(
271269 cx,
272- current_expr . span
270+ expr . span
273271 . with_lo( current_ident. span. hi( ) ) ,
274272 ".." ,
275273 applicability
@@ -302,7 +300,7 @@ impl <'expr> IdentIter<'expr> {
302300}
303301
304302impl < ' expr > Iterator for IdentIter < ' expr > {
305- type Item = ( Ident , & ' expr Expr ) ;
303+ type Item = Ident ;
306304
307305 fn next ( & mut self ) -> Option < Self :: Item > {
308306 if self . done {
@@ -336,11 +334,9 @@ impl <'expr> Iterator for IdentIter<'expr> {
336334 ExprKind :: Lit ( _) |ExprKind :: Err => None ,
337335 ExprKind :: Path ( _, ref path)
338336 | ExprKind :: MacCall ( MacCall { ref path, ..} ) => {
339- let current_expr: & ' expr Expr = self . expr ;
340-
341337 set_and_call_next ! (
342338 path. segments. iter( )
343- . map( move |s| ( s. ident, current_expr ) )
339+ . map( |s| s. ident)
344340 )
345341 } ,
346342 ExprKind :: Box ( ref expr)
@@ -365,10 +361,8 @@ impl <'expr> Iterator for IdentIter<'expr> {
365361 )
366362 } ,
367363 ExprKind :: MethodCall ( ref method_name, ref args, _) => {
368- let current_expr: & ' expr Expr = self . expr ;
369-
370364 set_and_call_next ! (
371- iter:: once( ( method_name. ident, current_expr ) )
365+ iter:: once( method_name. ident)
372366 . chain(
373367 args. iter( )
374368 . flat_map( IdentIter :: new_p)
0 commit comments