parent
65d88c7ba7
commit
4171299632
@ -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,
|
||||
|
@ -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"
|
||||
}
|
||||
|
||||
|
@ -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");
|
||||
|
@ -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");
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user