@@ -790,7 +790,7 @@ fn same_var<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &Expr, var: HirId) -> bo
790
790
if path. segments. len( ) == 1 ;
791
791
if let Def :: Local ( local_id) = cx. tables. qpath_def( qpath, expr. hir_id) ;
792
792
// our variable!
793
- if cx . tcx . hir ( ) . node_to_hir_id ( local_id) == var;
793
+ if local_id == var;
794
794
then {
795
795
return true ;
796
796
}
@@ -1657,13 +1657,13 @@ fn check_for_mutability(cx: &LateContext<'_, '_>, bound: &Expr) -> Option<HirId>
1657
1657
then {
1658
1658
let def = cx. tables. qpath_def( qpath, bound. hir_id) ;
1659
1659
if let Def :: Local ( node_id) = def {
1660
- let node_str = cx. tcx. hir( ) . get ( node_id) ;
1660
+ let node_str = cx. tcx. hir( ) . get_by_hir_id ( node_id) ;
1661
1661
if_chain! {
1662
1662
if let Node :: Binding ( pat) = node_str;
1663
1663
if let PatKind :: Binding ( bind_ann, ..) = pat. node;
1664
1664
if let BindingAnnotation :: Mutable = bind_ann;
1665
1665
then {
1666
- return Some ( cx . tcx . hir ( ) . node_to_hir_id ( node_id) ) ;
1666
+ return Some ( node_id) ;
1667
1667
}
1668
1668
}
1669
1669
}
@@ -1792,9 +1792,7 @@ impl<'a, 'tcx> VarVisitor<'a, 'tcx> {
1792
1792
}
1793
1793
let def = self . cx. tables. qpath_def( seqpath, seqexpr. hir_id) ;
1794
1794
match def {
1795
- Def :: Local ( node_id) | Def :: Upvar ( node_id, ..) => {
1796
- let hir_id = self . cx. tcx. hir( ) . node_to_hir_id( node_id) ;
1797
-
1795
+ Def :: Local ( hir_id) | Def :: Upvar ( hir_id, ..) => {
1798
1796
let parent_id = self . cx. tcx. hir( ) . get_parent_item( expr. hir_id) ;
1799
1797
let parent_def_id = self . cx. tcx. hir( ) . local_def_id_from_hir_id( parent_id) ;
1800
1798
let extent = self . cx. tcx. region_scope_tree( parent_def_id) . var_scope( hir_id. local_id) ;
@@ -1856,15 +1854,15 @@ impl<'a, 'tcx> Visitor<'tcx> for VarVisitor<'a, 'tcx> {
1856
1854
then {
1857
1855
match self . cx. tables. qpath_def( qpath, expr. hir_id) {
1858
1856
Def :: Upvar ( local_id, ..) => {
1859
- if self . cx . tcx . hir ( ) . node_to_hir_id ( local_id) == self . var {
1857
+ if local_id == self . var {
1860
1858
// we are not indexing anything, record that
1861
1859
self . nonindex = true ;
1862
1860
}
1863
1861
}
1864
1862
Def :: Local ( local_id) =>
1865
1863
{
1866
1864
1867
- if self . cx . tcx . hir ( ) . node_to_hir_id ( local_id) == self . var {
1865
+ if local_id == self . var {
1868
1866
self . nonindex = true ;
1869
1867
} else {
1870
1868
// not the correct variable, but still a variable
@@ -2209,7 +2207,7 @@ fn var_def_id(cx: &LateContext<'_, '_>, expr: &Expr) -> Option<HirId> {
2209
2207
if let ExprKind :: Path ( ref qpath) = expr. node {
2210
2208
let path_res = cx. tables . qpath_def ( qpath, expr. hir_id ) ;
2211
2209
if let Def :: Local ( node_id) = path_res {
2212
- return Some ( cx . tcx . hir ( ) . node_to_hir_id ( node_id) ) ;
2210
+ return Some ( node_id) ;
2213
2211
}
2214
2212
}
2215
2213
None
@@ -2404,7 +2402,7 @@ impl<'a, 'tcx> VarCollectorVisitor<'a, 'tcx> {
2404
2402
then {
2405
2403
match def {
2406
2404
Def :: Local ( node_id) | Def :: Upvar ( node_id, ..) => {
2407
- self . ids. insert( self . cx . tcx . hir ( ) . node_to_hir_id ( node_id) ) ;
2405
+ self . ids. insert( node_id) ;
2408
2406
} ,
2409
2407
Def :: Static ( def_id, mutable) => {
2410
2408
self . def_ids. insert( def_id, mutable) ;
0 commit comments