Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions clippy_lints/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,6 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
overflow_check_conditional::OVERFLOW_CHECK_CONDITIONAL,
panic_unimplemented::PANIC_PARAMS,
partialeq_ne_impl::PARTIALEQ_NE_IMPL,
path_buf_push_overwrite::PATH_BUF_PUSH_OVERWRITE,
precedence::PRECEDENCE,
ptr::CMP_NULL,
ptr::MUT_FROM_REF,
Expand Down Expand Up @@ -1075,7 +1074,6 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
non_copy_const::BORROW_INTERIOR_MUTABLE_CONST,
non_copy_const::DECLARE_INTERIOR_MUTABLE_CONST,
open_options::NONSENSICAL_OPEN_OPTIONS,
path_buf_push_overwrite::PATH_BUF_PUSH_OVERWRITE,
ptr::MUT_FROM_REF,
ranges::ITERATOR_STEP_BY_ZERO,
regex::INVALID_REGEX,
Expand Down Expand Up @@ -1125,6 +1123,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
missing_const_for_fn::MISSING_CONST_FOR_FN,
mutex_atomic::MUTEX_INTEGER,
needless_borrow::NEEDLESS_BORROW,
path_buf_push_overwrite::PATH_BUF_PUSH_OVERWRITE,
redundant_clone::REDUNDANT_CLONE,
unwrap::PANICKING_UNWRAP,
unwrap::UNNECESSARY_UNWRAP,
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/path_buf_push_overwrite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ declare_clippy_lint! {
/// assert_eq!(x, PathBuf::from("/foo/bar"));
/// ```
pub PATH_BUF_PUSH_OVERWRITE,
correctness,
nursery,
"calling `push` with file system root on `PathBuf` can overwrite it"
}

Expand Down
1 change: 1 addition & 0 deletions tests/ui/path_buf_push_overwrite.fixed
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// run-rustfix
use std::path::PathBuf;

#[warn(clippy::all, clippy::path_buf_push_overwrite)]
fn main() {
let mut x = PathBuf::from("/foo");
x.push("bar");
Expand Down
1 change: 1 addition & 0 deletions tests/ui/path_buf_push_overwrite.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// run-rustfix
use std::path::PathBuf;

#[warn(clippy::all, clippy::path_buf_push_overwrite)]
fn main() {
let mut x = PathBuf::from("/foo");
x.push("/bar");
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/path_buf_push_overwrite.stderr
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
error: Calling `push` with '/' or '/' (file system root) will overwrite the previous path definition
--> $DIR/path_buf_push_overwrite.rs:6:12
--> $DIR/path_buf_push_overwrite.rs:7:12
|
LL | x.push("/bar");
| ^^^^^^ help: try: `"bar"`
|
= note: #[deny(clippy::path_buf_push_overwrite)] on by default
= note: `-D clippy::path-buf-push-overwrite` implied by `-D warnings`

error: aborting due to previous error