|
1 | 1 | use super::{IncrementVisitor, InitializeVisitor, MANUAL_MEMCPY}; |
2 | 2 | use clippy_utils::diagnostics::span_lint_and_sugg; |
| 3 | +use clippy_utils::res::MaybeResPath; |
3 | 4 | use clippy_utils::source::snippet; |
4 | 5 | use clippy_utils::sugg::Sugg; |
5 | 6 | use clippy_utils::ty::is_copy; |
6 | 7 | use clippy_utils::usage::local_used_in; |
7 | | -use clippy_utils::{get_enclosing_block, higher, path_to_local, sugg}; |
| 8 | +use clippy_utils::{get_enclosing_block, higher, sugg}; |
8 | 9 | use rustc_ast::ast; |
9 | 10 | use rustc_errors::Applicability; |
10 | 11 | use rustc_hir::intravisit::walk_block; |
@@ -67,7 +68,7 @@ pub(super) fn check<'tcx>( |
67 | 68 | && !local_used_in(cx, canonical_id, base_left) |
68 | 69 | && !local_used_in(cx, canonical_id, base_right) |
69 | 70 | // Source and destination must be different |
70 | | - && path_to_local(base_left) != path_to_local(base_right) |
| 71 | + && base_left.res_local_id() != base_right.res_local_id() |
71 | 72 | { |
72 | 73 | Some(( |
73 | 74 | ty, |
@@ -128,7 +129,7 @@ fn build_manual_memcpy_suggestion<'tcx>( |
128 | 129 | let print_limit = |end: &Expr<'_>, end_str: &str, base: &Expr<'_>, sugg: MinifyingSugg<'static>| { |
129 | 130 | if let ExprKind::MethodCall(method, recv, [], _) = end.kind |
130 | 131 | && method.ident.name == sym::len |
131 | | - && path_to_local(recv) == path_to_local(base) |
| 132 | + && recv.res_local_id() == base.res_local_id() |
132 | 133 | { |
133 | 134 | if sugg.to_string() == end_str { |
134 | 135 | sugg::EMPTY.into() |
@@ -364,7 +365,7 @@ fn get_details_from_idx<'tcx>( |
364 | 365 | starts: &[Start<'tcx>], |
365 | 366 | ) -> Option<(StartKind<'tcx>, Offset)> { |
366 | 367 | fn get_start<'tcx>(e: &Expr<'_>, starts: &[Start<'tcx>]) -> Option<StartKind<'tcx>> { |
367 | | - let id = path_to_local(e)?; |
| 368 | + let id = e.res_local_id()?; |
368 | 369 | starts.iter().find(|start| start.id == id).map(|start| start.kind) |
369 | 370 | } |
370 | 371 |
|
@@ -425,7 +426,7 @@ fn get_assignments<'a, 'tcx>( |
425 | 426 | .chain(*expr) |
426 | 427 | .filter(move |e| { |
427 | 428 | if let ExprKind::AssignOp(_, place, _) = e.kind { |
428 | | - path_to_local(place).is_some_and(|id| { |
| 429 | + place.res_local_id().is_some_and(|id| { |
429 | 430 | !loop_counters |
430 | 431 | .iter() |
431 | 432 | // skip the first item which should be `StartKind::Range` |
|
0 commit comments