Skip to content

Commit 3921ed6

Browse files
committed
[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`).
1 parent 8d0c0eb commit 3921ed6

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

Lines changed: 1 addition & 1 deletion
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)