]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/clippy/clippy_lints/src/path_buf_push_overwrite.rs
Auto merge of #78420 - estebank:suggest-assoc-fn, r=petrochenkov
[rust.git] / src / tools / clippy / clippy_lints / src / path_buf_push_overwrite.rs
index b8583402928b424013200de3d1680352c3f34b12..6eeb031d383c856e1e195e865415abe4fd367cb8 100644 (file)
@@ -1,4 +1,4 @@
-use crate::utils::{match_type, paths, span_lint_and_sugg, walk_ptrs_ty};
+use crate::utils::{match_type, paths, span_lint_and_sugg};
 use if_chain::if_chain;
 use rustc_ast::ast::LitKind;
 use rustc_errors::Applicability;
@@ -46,7 +46,7 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
             if let ExprKind::MethodCall(ref path, _, ref args, _) = expr.kind;
             if path.ident.name == sym!(push);
             if args.len() == 2;
-            if match_type(cx, walk_ptrs_ty(cx.typeck_results().expr_ty(&args[0])), &paths::PATH_BUF);
+            if match_type(cx, cx.typeck_results().expr_ty(&args[0]).peel_refs(), &paths::PATH_BUF);
             if let Some(get_index_arg) = args.get(1);
             if let ExprKind::Lit(ref lit) = get_index_arg.kind;
             if let LitKind::Str(ref path_lit, _) = lit.node;