@@ -11,7 +11,7 @@ use rustc::{declare_lint_pass, declare_tool_lint};
11
11
// use rustc::middle::region::CodeExtent;
12
12
use crate :: consts:: { constant, Constant } ;
13
13
use crate :: utils:: usage:: mutated_variables;
14
- use crate :: utils:: { is_type_diagnostic_item, sext, sugg} ;
14
+ use crate :: utils:: { is_type_diagnostic_item, qpath_res , sext, sugg} ;
15
15
use rustc:: middle:: expr_use_visitor:: * ;
16
16
use rustc:: middle:: mem_categorization:: cmt_;
17
17
use rustc:: middle:: mem_categorization:: Categorization ;
@@ -754,7 +754,7 @@ fn same_var<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &Expr, var: HirId) -> bo
754
754
if let ExprKind :: Path ( ref qpath) = expr. node;
755
755
if let QPath :: Resolved ( None , ref path) = * qpath;
756
756
if path. segments. len( ) == 1 ;
757
- if let Res :: Local ( local_id) = cx . tables . qpath_res( qpath, expr. hir_id) ;
757
+ if let Res :: Local ( local_id) = qpath_res( cx , qpath, expr. hir_id) ;
758
758
// our variable!
759
759
if local_id == var;
760
760
then {
@@ -1618,7 +1618,7 @@ fn check_for_mutability(cx: &LateContext<'_, '_>, bound: &Expr) -> Option<HirId>
1618
1618
if let ExprKind :: Path ( ref qpath) = bound. node;
1619
1619
if let QPath :: Resolved ( None , _) = * qpath;
1620
1620
then {
1621
- let res = cx . tables . qpath_res( qpath, bound. hir_id) ;
1621
+ let res = qpath_res( cx , qpath, bound. hir_id) ;
1622
1622
if let Res :: Local ( node_id) = res {
1623
1623
let node_str = cx. tcx. hir( ) . get( node_id) ;
1624
1624
if_chain! {
@@ -1762,7 +1762,7 @@ impl<'a, 'tcx> VarVisitor<'a, 'tcx> {
1762
1762
if self . prefer_mutable {
1763
1763
self . indexed_mut. insert( seqvar. segments[ 0 ] . ident. name) ;
1764
1764
}
1765
- let res = self . cx. tables . qpath_res ( seqpath, seqexpr. hir_id) ;
1765
+ let res = qpath_res ( self . cx, seqpath, seqexpr. hir_id) ;
1766
1766
match res {
1767
1767
Res :: Local ( hir_id) => {
1768
1768
let parent_id = self . cx. tcx. hir( ) . get_parent_item( expr. hir_id) ;
@@ -1824,7 +1824,7 @@ impl<'a, 'tcx> Visitor<'tcx> for VarVisitor<'a, 'tcx> {
1824
1824
if let QPath :: Resolved ( None , ref path) = * qpath;
1825
1825
if path. segments. len( ) == 1 ;
1826
1826
then {
1827
- if let Res :: Local ( local_id) = self . cx. tables . qpath_res ( qpath, expr. hir_id) {
1827
+ if let Res :: Local ( local_id) = qpath_res ( self . cx, qpath, expr. hir_id) {
1828
1828
if local_id == self . var {
1829
1829
self . nonindex = true ;
1830
1830
} else {
@@ -2163,7 +2163,7 @@ impl<'a, 'tcx> Visitor<'tcx> for InitializeVisitor<'a, 'tcx> {
2163
2163
2164
2164
fn var_def_id ( cx : & LateContext < ' _ , ' _ > , expr : & Expr ) -> Option < HirId > {
2165
2165
if let ExprKind :: Path ( ref qpath) = expr. node {
2166
- let path_res = cx . tables . qpath_res ( qpath, expr. hir_id ) ;
2166
+ let path_res = qpath_res ( cx , qpath, expr. hir_id ) ;
2167
2167
if let Res :: Local ( node_id) = path_res {
2168
2168
return Some ( node_id) ;
2169
2169
}
@@ -2355,7 +2355,7 @@ impl<'a, 'tcx> VarCollectorVisitor<'a, 'tcx> {
2355
2355
if_chain ! {
2356
2356
if let ExprKind :: Path ( ref qpath) = ex. node;
2357
2357
if let QPath :: Resolved ( None , _) = * qpath;
2358
- let res = self . cx. tables . qpath_res ( qpath, ex. hir_id) ;
2358
+ let res = qpath_res ( self . cx, qpath, ex. hir_id) ;
2359
2359
then {
2360
2360
match res {
2361
2361
Res :: Local ( node_id) => {
0 commit comments