@@ -286,7 +286,7 @@ impl LateLintPass for LoopsPass {
286
286
if let Some ( lhs_constructor) = path. segments . last ( ) {
287
287
if method_name. node . as_str ( ) == "next" &&
288
288
match_trait_method ( cx, match_expr, & paths:: ITERATOR ) &&
289
- lhs_constructor. identifier . name . as_str ( ) == "Some" &&
289
+ lhs_constructor. name . as_str ( ) == "Some" &&
290
290
!is_iterator_used_after_while_let ( cx, iter_expr) {
291
291
let iterator = snippet ( cx, method_args[ 0 ] . span , "_" ) ;
292
292
let loop_var = snippet ( cx, pat_args[ 0 ] . span , "_" ) ;
@@ -333,7 +333,7 @@ fn check_for_loop_range(cx: &LateContext, pat: &Pat, arg: &Expr, body: &Expr, ex
333
333
if let PatKind :: Ident ( _, ref ident, _) = pat. node {
334
334
let mut visitor = VarVisitor {
335
335
cx : cx,
336
- var : ident. node . name ,
336
+ var : ident. node ,
337
337
indexed : HashMap :: new ( ) ,
338
338
nonindex : false ,
339
339
} ;
@@ -378,9 +378,9 @@ fn check_for_loop_range(cx: &LateContext, pat: &Pat, arg: &Expr, body: &Expr, ex
378
378
expr. span ,
379
379
& format ! ( "the loop variable `{}` is used to index `{}`. Consider using `for ({}, \
380
380
item) in {}.iter().enumerate(){}{}` or similar iterators",
381
- ident. node. name ,
381
+ ident. node,
382
382
indexed,
383
- ident. node. name ,
383
+ ident. node,
384
384
indexed,
385
385
take,
386
386
skip) ) ;
@@ -396,7 +396,7 @@ fn check_for_loop_range(cx: &LateContext, pat: &Pat, arg: &Expr, body: &Expr, ex
396
396
expr. span ,
397
397
& format ! ( "the loop variable `{}` is only used to index `{}`. \
398
398
Consider using `for item in {}` or similar iterators",
399
- ident. node. name ,
399
+ ident. node,
400
400
indexed,
401
401
repl) ) ;
402
402
}
@@ -412,7 +412,7 @@ fn is_len_call(expr: &Expr, var: &Name) -> bool {
412
412
method. node. as_str( ) == "len" ,
413
413
let ExprPath ( _, ref path) = len_args[ 0 ] . node,
414
414
path. segments. len( ) == 1 ,
415
- & path. segments[ 0 ] . identifier . name == var
415
+ & path. segments[ 0 ] . name == var
416
416
] , {
417
417
return true ;
418
418
} }
@@ -613,7 +613,7 @@ fn check_for_loop_over_map_kv(cx: &LateContext, pat: &Pat, arg: &Expr, body: &Ex
613
613
fn pat_is_wild ( pat : & PatKind , body : & Expr ) -> bool {
614
614
match * pat {
615
615
PatKind :: Wild => true ,
616
- PatKind :: Ident ( _, ident, None ) if ident. node . name . as_str ( ) . starts_with ( '_' ) => {
616
+ PatKind :: Ident ( _, ident, None ) if ident. node . as_str ( ) . starts_with ( '_' ) => {
617
617
let mut visitor = UsedVisitor {
618
618
var : ident. node ,
619
619
used : false ,
@@ -626,14 +626,14 @@ fn pat_is_wild(pat: &PatKind, body: &Expr) -> bool {
626
626
}
627
627
628
628
struct UsedVisitor {
629
- var : Ident , // var to look for
629
+ var : ast :: Name , // var to look for
630
630
used : bool , // has the var been used otherwise?
631
631
}
632
632
633
633
impl < ' a > Visitor < ' a > for UsedVisitor {
634
634
fn visit_expr ( & mut self , expr : & Expr ) {
635
635
if let ExprPath ( None , ref path) = expr. node {
636
- if path. segments . len ( ) == 1 && path. segments [ 0 ] . identifier == self . var {
636
+ if path. segments . len ( ) == 1 && path. segments [ 0 ] . name == self . var {
637
637
self . used = true ;
638
638
return ;
639
639
}
@@ -653,7 +653,7 @@ struct VarVisitor<'v, 't: 'v> {
653
653
impl < ' v , ' t > Visitor < ' v > for VarVisitor < ' v , ' t > {
654
654
fn visit_expr ( & mut self , expr : & ' v Expr ) {
655
655
if let ExprPath ( None , ref path) = expr. node {
656
- if path. segments . len ( ) == 1 && path. segments [ 0 ] . identifier . name == self . var {
656
+ if path. segments . len ( ) == 1 && path. segments [ 0 ] . name == self . var {
657
657
// we are referencing our variable! now check if it's as an index
658
658
if_let_chain ! {
659
659
[
@@ -667,11 +667,11 @@ impl<'v, 't> Visitor<'v> for VarVisitor<'v, 't> {
667
667
match def. base_def {
668
668
Def :: Local ( ..) | Def :: Upvar ( ..) => {
669
669
let extent = self . cx. tcx. region_maps. var_scope( def. base_def. var_id( ) ) ;
670
- self . indexed. insert( seqvar. segments[ 0 ] . identifier . name, Some ( extent) ) ;
670
+ self . indexed. insert( seqvar. segments[ 0 ] . name, Some ( extent) ) ;
671
671
return ; // no need to walk further
672
672
}
673
673
Def :: Static ( ..) | Def :: Const ( ..) => {
674
- self . indexed. insert( seqvar. segments[ 0 ] . identifier . name, None ) ;
674
+ self . indexed. insert( seqvar. segments[ 0 ] . name, None ) ;
675
675
return ; // no need to walk further
676
676
}
677
677
_ => ( ) ,
@@ -885,7 +885,7 @@ impl<'v, 't> Visitor<'v> for InitializeVisitor<'v, 't> {
885
885
if let DeclLocal ( ref local) = decl. node {
886
886
if local. pat . id == self . var_id {
887
887
if let PatKind :: Ident ( _, ref ident, _) = local. pat . node {
888
- self . name = Some ( ident. node . name ) ;
888
+ self . name = Some ( ident. node ) ;
889
889
890
890
self . state = if let Some ( ref init) = local. init {
891
891
if is_integer_literal ( init, 0 ) {
0 commit comments