@@ -11,7 +11,7 @@ use rustc::{declare_lint_pass, declare_tool_lint};
1111// use rustc::middle::region::CodeExtent;
1212use crate :: consts:: { constant, Constant } ;
1313use 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} ;
1515use rustc:: middle:: expr_use_visitor:: * ;
1616use rustc:: middle:: mem_categorization:: cmt_;
1717use rustc:: middle:: mem_categorization:: Categorization ;
@@ -754,7 +754,7 @@ fn same_var<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &Expr, var: HirId) -> bo
754754 if let ExprKind :: Path ( ref qpath) = expr. node;
755755 if let QPath :: Resolved ( None , ref path) = * qpath;
756756 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) ;
758758 // our variable!
759759 if local_id == var;
760760 then {
@@ -1618,7 +1618,7 @@ fn check_for_mutability(cx: &LateContext<'_, '_>, bound: &Expr) -> Option<HirId>
16181618 if let ExprKind :: Path ( ref qpath) = bound. node;
16191619 if let QPath :: Resolved ( None , _) = * qpath;
16201620 then {
1621- let res = cx . tables . qpath_res( qpath, bound. hir_id) ;
1621+ let res = qpath_res( cx , qpath, bound. hir_id) ;
16221622 if let Res :: Local ( node_id) = res {
16231623 let node_str = cx. tcx. hir( ) . get( node_id) ;
16241624 if_chain! {
@@ -1762,7 +1762,7 @@ impl<'a, 'tcx> VarVisitor<'a, 'tcx> {
17621762 if self . prefer_mutable {
17631763 self . indexed_mut. insert( seqvar. segments[ 0 ] . ident. name) ;
17641764 }
1765- let res = self . cx. tables . qpath_res ( seqpath, seqexpr. hir_id) ;
1765+ let res = qpath_res ( self . cx, seqpath, seqexpr. hir_id) ;
17661766 match res {
17671767 Res :: Local ( hir_id) => {
17681768 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> {
18241824 if let QPath :: Resolved ( None , ref path) = * qpath;
18251825 if path. segments. len( ) == 1 ;
18261826 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) {
18281828 if local_id == self . var {
18291829 self . nonindex = true ;
18301830 } else {
@@ -2163,7 +2163,7 @@ impl<'a, 'tcx> Visitor<'tcx> for InitializeVisitor<'a, 'tcx> {
21632163
21642164fn var_def_id ( cx : & LateContext < ' _ , ' _ > , expr : & Expr ) -> Option < HirId > {
21652165 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 ) ;
21672167 if let Res :: Local ( node_id) = path_res {
21682168 return Some ( node_id) ;
21692169 }
@@ -2355,7 +2355,7 @@ impl<'a, 'tcx> VarCollectorVisitor<'a, 'tcx> {
23552355 if_chain ! {
23562356 if let ExprKind :: Path ( ref qpath) = ex. node;
23572357 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) ;
23592359 then {
23602360 match res {
23612361 Res :: Local ( node_id) => {
0 commit comments