@@ -6,9 +6,9 @@ use crate::utils::visitors::LocalUsedVisitor;
6
6
use crate :: utils:: {
7
7
contains_name, get_enclosing_block, get_parent_expr, get_trait_def_id, has_iter_method, higher, implements_trait,
8
8
indent_of, is_in_panic_handler, is_integer_const, is_no_std_crate, is_refutable, is_type_diagnostic_item,
9
- last_path_segment, match_trait_method, match_type, match_var, multispan_sugg, qpath_res , single_segment_path ,
10
- snippet , snippet_with_applicability, snippet_with_macro_callsite, span_lint, span_lint_and_help,
11
- span_lint_and_sugg , span_lint_and_then, sugg, SpanlessEq ,
9
+ last_path_segment, match_trait_method, match_type, match_var, multispan_sugg, single_segment_path , snippet ,
10
+ snippet_with_applicability, snippet_with_macro_callsite, span_lint, span_lint_and_help, span_lint_and_sugg ,
11
+ span_lint_and_then, sugg, SpanlessEq ,
12
12
} ;
13
13
use if_chain:: if_chain;
14
14
use rustc_ast:: ast;
@@ -848,7 +848,7 @@ fn same_var<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'_>, var: HirId) -> bool {
848
848
if let ExprKind :: Path ( qpath) = & expr. kind;
849
849
if let QPath :: Resolved ( None , path) = qpath;
850
850
if path. segments. len( ) == 1 ;
851
- if let Res :: Local ( local_id) = qpath_res( cx , qpath, expr. hir_id) ;
851
+ if let Res :: Local ( local_id) = cx . qpath_res( qpath, expr. hir_id) ;
852
852
then {
853
853
// our variable!
854
854
local_id == var
@@ -1420,7 +1420,7 @@ fn detect_same_item_push<'tcx>(
1420
1420
// Make sure that the push does not involve possibly mutating values
1421
1421
match pushed_item. kind {
1422
1422
ExprKind :: Path ( ref qpath) => {
1423
- match qpath_res ( cx , qpath, pushed_item. hir_id ) {
1423
+ match cx . qpath_res ( qpath, pushed_item. hir_id ) {
1424
1424
// immutable bindings that are initialized with literal or constant
1425
1425
Res :: Local ( hir_id) => {
1426
1426
if_chain ! {
@@ -1437,7 +1437,7 @@ fn detect_same_item_push<'tcx>(
1437
1437
ExprKind :: Lit ( ..) => emit_lint( cx, vec, pushed_item) ,
1438
1438
// immutable bindings that are initialized with constant
1439
1439
ExprKind :: Path ( ref path) => {
1440
- if let Res :: Def ( DefKind :: Const , ..) = qpath_res( cx , path, init. hir_id) {
1440
+ if let Res :: Def ( DefKind :: Const , ..) = cx . qpath_res( path, init. hir_id) {
1441
1441
emit_lint( cx, vec, pushed_item) ;
1442
1442
}
1443
1443
}
@@ -2028,7 +2028,7 @@ fn check_for_mutability(cx: &LateContext<'_>, bound: &Expr<'_>) -> Option<HirId>
2028
2028
if let ExprKind :: Path ( ref qpath) = bound. kind;
2029
2029
if let QPath :: Resolved ( None , _) = * qpath;
2030
2030
then {
2031
- let res = qpath_res( cx , qpath, bound. hir_id) ;
2031
+ let res = cx . qpath_res( qpath, bound. hir_id) ;
2032
2032
if let Res :: Local ( hir_id) = res {
2033
2033
let node_str = cx. tcx. hir( ) . get( hir_id) ;
2034
2034
if_chain! {
@@ -2120,7 +2120,7 @@ impl<'a, 'tcx> VarVisitor<'a, 'tcx> {
2120
2120
if self . prefer_mutable {
2121
2121
self . indexed_mut. insert( seqvar. segments[ 0 ] . ident. name) ;
2122
2122
}
2123
- let res = qpath_res ( self . cx, seqpath, seqexpr. hir_id) ;
2123
+ let res = self . cx. qpath_res ( seqpath, seqexpr. hir_id) ;
2124
2124
match res {
2125
2125
Res :: Local ( hir_id) => {
2126
2126
let parent_id = self . cx. tcx. hir( ) . get_parent_item( expr. hir_id) ;
@@ -2184,7 +2184,7 @@ impl<'a, 'tcx> Visitor<'tcx> for VarVisitor<'a, 'tcx> {
2184
2184
if let QPath :: Resolved ( None , ref path) = * qpath;
2185
2185
if path. segments. len( ) == 1 ;
2186
2186
then {
2187
- if let Res :: Local ( local_id) = qpath_res ( self . cx, qpath, expr. hir_id) {
2187
+ if let Res :: Local ( local_id) = self . cx. qpath_res ( qpath, expr. hir_id) {
2188
2188
if local_id == self . var {
2189
2189
self . nonindex = true ;
2190
2190
} else {
@@ -2589,7 +2589,7 @@ impl<'a, 'tcx> Visitor<'tcx> for InitializeVisitor<'a, 'tcx> {
2589
2589
2590
2590
fn var_def_id ( cx : & LateContext < ' _ > , expr : & Expr < ' _ > ) -> Option < HirId > {
2591
2591
if let ExprKind :: Path ( ref qpath) = expr. kind {
2592
- let path_res = qpath_res ( cx , qpath, expr. hir_id ) ;
2592
+ let path_res = cx . qpath_res ( qpath, expr. hir_id ) ;
2593
2593
if let Res :: Local ( hir_id) = path_res {
2594
2594
return Some ( hir_id) ;
2595
2595
}
@@ -2819,7 +2819,7 @@ impl<'a, 'tcx> VarCollectorVisitor<'a, 'tcx> {
2819
2819
if_chain ! {
2820
2820
if let ExprKind :: Path ( ref qpath) = ex. kind;
2821
2821
if let QPath :: Resolved ( None , _) = * qpath;
2822
- let res = qpath_res ( self . cx, qpath, ex. hir_id) ;
2822
+ let res = self . cx. qpath_res ( qpath, ex. hir_id) ;
2823
2823
then {
2824
2824
match res {
2825
2825
Res :: Local ( hir_id) => {
0 commit comments