[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`).
This commit is contained in:
Samuel Tardieu 2025-01-16 18:12:36 +01:00
parent 8d0c0eb917
commit 3921ed67b2

View file

@ -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,
);
}
}