about summary refs log tree commit diff
path: root/clippy_lints/src/path_buf_push_overwrite.rs
diff options
context:
space:
mode:
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());