about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2025-01-16 18:12:36 +0100
committerSamuel Tardieu <sam@rfc1149.net>2025-01-16 18:16:29 +0100
commit3921ed67b20a4541b1fa378de95c1dbe3d5cc5ef (patch)
treeaeaee46019b746fe8843d1d332cfc3cfae15d2eb
parent8d0c0eb9173723342844b02f7c0a4596168d26c5 (diff)
downloadrust-3921ed67b20a4541b1fa378de95c1dbe3d5cc5ef.tar.gz
rust-3921ed67b20a4541b1fa378de95c1dbe3d5cc5ef.zip
[`path_buf_push_overwrite`]: mark suggestion as `MaybeIncorrect`
Proposing to replace

```rust
let mut x = PathBuf::from("/foo");
x.push("/bar");
```

by

```rust
let mut x = PathBuf::from("/foo");
x.push("bar");
```

changes the content of `x` (`/bar` ⇒ `/foo/bar`).
-rw-r--r--clippy_lints/src/methods/path_buf_push_overwrite.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/clippy_lints/src/methods/path_buf_push_overwrite.rs b/clippy_lints/src/methods/path_buf_push_overwrite.rs
index 2d3007e50b8..38d9c5f1677 100644
--- a/clippy_lints/src/methods/path_buf_push_overwrite.rs
+++ b/clippy_lints/src/methods/path_buf_push_overwrite.rs
@@ -28,7 +28,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>, arg: &'t
             "calling `push` with '/' or '\\' (file system root) will overwrite the previous path definition",
             "try",
             format!("\"{}\"", pushed_path_lit.trim_start_matches(['/', '\\'])),
-            Applicability::MachineApplicable,
+            Applicability::MaybeIncorrect,
         );
     }
 }