about summary refs log tree commit diff
path: root/clippy_lints/src/path_buf_push_overwrite.rs
diff options
context:
space:
mode:
authorPhilipp Krones <hello@philkrones.com>2022-08-11 19:42:16 +0200
committerPhilipp Krones <hello@philkrones.com>2022-08-11 19:42:16 +0200
commitdc29cfb8d5338af23e6b06aaff6cc0229e688da0 (patch)
treefa40202be0b823c66362915e3aa6a877578368d1 /clippy_lints/src/path_buf_push_overwrite.rs
parentf719599c0f8eedc504ddedfcbb9e196128b8b129 (diff)
Merge commit '2b2190cb5667cdd276a24ef8b9f3692209c54a89' into clippyup
Diffstat (limited to 'clippy_lints/src/path_buf_push_overwrite.rs')
-rw-r--r--clippy_lints/src/path_buf_push_overwrite.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/clippy_lints/src/path_buf_push_overwrite.rs b/clippy_lints/src/path_buf_push_overwrite.rs
index 3f940ce61c0..bc6a918f703 100644
--- a/clippy_lints/src/path_buf_push_overwrite.rs
+++ b/clippy_lints/src/path_buf_push_overwrite.rs
@@ -46,11 +46,9 @@ declare_lint_pass!(PathBufPushOverwrite => [PATH_BUF_PUSH_OVERWRITE]);
 impl<'tcx> LateLintPass<'tcx> for PathBufPushOverwrite {
     fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
         if_chain! {
-            if let ExprKind::MethodCall(path, args, _) = expr.kind;
+            if let ExprKind::MethodCall(path, [recv, get_index_arg], _) = expr.kind;
             if path.ident.name == sym!(push);
-            if args.len() == 2;
-            if is_type_diagnostic_item(cx, cx.typeck_results().expr_ty(&args[0]).peel_refs(), sym::PathBuf);
-            if let Some(get_index_arg) = args.get(1);
+            if is_type_diagnostic_item(cx, cx.typeck_results().expr_ty(recv).peel_refs(), sym::PathBuf);
             if let ExprKind::Lit(ref lit) = get_index_arg.kind;
             if let LitKind::Str(ref path_lit, _) = lit.node;
             if let pushed_path = Path::new(path_lit.as_str());