Skip to content

Commit b5ea249

Browse files
authored
[path_buf_push_overwrite]: mark suggestion as MaybeIncorrect (#14010)
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 is not equivalent and should not be `MachineApplicable`, even if the original code is suspicious. changelog: none
2 parents 9289cca + 3921ed6 commit b5ea249

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clippy_lints/src/methods/path_buf_push_overwrite.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>, arg: &'t
2828
"calling `push` with '/' or '\\' (file system root) will overwrite the previous path definition",
2929
"try",
3030
format!("\"{}\"", pushed_path_lit.trim_start_matches(['/', '\\'])),
31-
Applicability::MachineApplicable,
31+
Applicability::MaybeIncorrect,
3232
);
3333
}
3434
}

0 commit comments

Comments
 (0)