diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs index 27066167003d..4220e6a738bb 100644 --- a/clippy_lints/src/lib.rs +++ b/clippy_lints/src/lib.rs @@ -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, @@ -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, @@ -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, diff --git a/clippy_lints/src/path_buf_push_overwrite.rs b/clippy_lints/src/path_buf_push_overwrite.rs index 10ca3d523abd..ce9947298fa5 100644 --- a/clippy_lints/src/path_buf_push_overwrite.rs +++ b/clippy_lints/src/path_buf_push_overwrite.rs @@ -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" } diff --git a/tests/ui/path_buf_push_overwrite.rs b/tests/ui/path_buf_push_overwrite.rs index d255e0f2d096..6e2d483f4541 100644 --- a/tests/ui/path_buf_push_overwrite.rs +++ b/tests/ui/path_buf_push_overwrite.rs @@ -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"); diff --git a/tests/ui/path_buf_push_overwrite.stderr b/tests/ui/path_buf_push_overwrite.stderr index 35572d792498..09b18d71baf9 100644 --- a/tests/ui/path_buf_push_overwrite.stderr +++ b/tests/ui/path_buf_push_overwrite.stderr @@ -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