Skip to content

Commit d420589

Browse files
committed
Auto merge of #4013 - kraai:move-path_buf_push_overwrite-to-nursery, r=matthiaskrgr
Move path_buf_push_overwrite to nursery See #4012. changelog: move `path_buf_push_overwrite` to the nursery
2 parents addac4a + 4171299 commit d420589

File tree

5 files changed

+6
-5
lines changed

5 files changed

+6
-5
lines changed

clippy_lints/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,6 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
807807
overflow_check_conditional::OVERFLOW_CHECK_CONDITIONAL,
808808
panic_unimplemented::PANIC_PARAMS,
809809
partialeq_ne_impl::PARTIALEQ_NE_IMPL,
810-
path_buf_push_overwrite::PATH_BUF_PUSH_OVERWRITE,
811810
precedence::PRECEDENCE,
812811
ptr::CMP_NULL,
813812
ptr::MUT_FROM_REF,
@@ -1075,7 +1074,6 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
10751074
non_copy_const::BORROW_INTERIOR_MUTABLE_CONST,
10761075
non_copy_const::DECLARE_INTERIOR_MUTABLE_CONST,
10771076
open_options::NONSENSICAL_OPEN_OPTIONS,
1078-
path_buf_push_overwrite::PATH_BUF_PUSH_OVERWRITE,
10791077
ptr::MUT_FROM_REF,
10801078
ranges::ITERATOR_STEP_BY_ZERO,
10811079
regex::INVALID_REGEX,
@@ -1125,6 +1123,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
11251123
missing_const_for_fn::MISSING_CONST_FOR_FN,
11261124
mutex_atomic::MUTEX_INTEGER,
11271125
needless_borrow::NEEDLESS_BORROW,
1126+
path_buf_push_overwrite::PATH_BUF_PUSH_OVERWRITE,
11281127
redundant_clone::REDUNDANT_CLONE,
11291128
unwrap::PANICKING_UNWRAP,
11301129
unwrap::UNNECESSARY_UNWRAP,

clippy_lints/src/path_buf_push_overwrite.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ declare_clippy_lint! {
3434
/// assert_eq!(x, PathBuf::from("/foo/bar"));
3535
/// ```
3636
pub PATH_BUF_PUSH_OVERWRITE,
37-
correctness,
37+
nursery,
3838
"calling `push` with file system root on `PathBuf` can overwrite it"
3939
}
4040

tests/ui/path_buf_push_overwrite.fixed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// run-rustfix
22
use std::path::PathBuf;
33

4+
#[warn(clippy::all, clippy::path_buf_push_overwrite)]
45
fn main() {
56
let mut x = PathBuf::from("/foo");
67
x.push("bar");

tests/ui/path_buf_push_overwrite.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// run-rustfix
22
use std::path::PathBuf;
33

4+
#[warn(clippy::all, clippy::path_buf_push_overwrite)]
45
fn main() {
56
let mut x = PathBuf::from("/foo");
67
x.push("/bar");
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
error: Calling `push` with '/' or '/' (file system root) will overwrite the previous path definition
2-
--> $DIR/path_buf_push_overwrite.rs:6:12
2+
--> $DIR/path_buf_push_overwrite.rs:7:12
33
|
44
LL | x.push("/bar");
55
| ^^^^^^ help: try: `"bar"`
66
|
7-
= note: #[deny(clippy::path_buf_push_overwrite)] on by default
7+
= note: `-D clippy::path-buf-push-overwrite` implied by `-D warnings`
88

99
error: aborting due to previous error
1010

0 commit comments

Comments
 (0)