mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 15:14:29 +00:00
(was merged as part of https://github.com/rust-lang/rust/pull/62782 )
This commit is contained in:
parent
c46727319e
commit
deb586a0c6
22 changed files with 24 additions and 24 deletions
|
@ -141,7 +141,7 @@ error: <-comparison of unit values detected. This will always be false
|
|||
LL | () < {};
|
||||
| ^^^^^^^
|
||||
|
|
||||
= note: #[deny(clippy::unit_cmp)] on by default
|
||||
= note: `#[deny(clippy::unit_cmp)]` on by default
|
||||
|
||||
error: aborting due to 18 previous errors
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ error: this operation will always return zero. This is likely not the intended o
|
|||
LL | x & 0 == 0;
|
||||
| ^^^^^
|
||||
|
|
||||
= note: #[deny(clippy::erasing_op)] on by default
|
||||
= note: `#[deny(clippy::erasing_op)]` on by default
|
||||
|
||||
error: incompatible bit mask: `_ & 2` can never be equal to `1`
|
||||
--> $DIR/bit_masks.rs:17:5
|
||||
|
|
|
@ -4,7 +4,7 @@ error: you are getting the inner pointer of a temporary `CString`
|
|||
LL | CString::new("foo").unwrap().as_ptr();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(clippy::temporary_cstring_as_ptr)] on by default
|
||||
= note: `#[deny(clippy::temporary_cstring_as_ptr)]` on by default
|
||||
= note: that pointer will be invalid outside this expression
|
||||
help: assign the `CString` to a variable to extend its lifetime
|
||||
--> $DIR/cstring.rs:7:5
|
||||
|
|
|
@ -4,7 +4,7 @@ error: you are deriving `Hash` but have implemented `PartialEq` explicitly
|
|||
LL | #[derive(Hash)]
|
||||
| ^^^^
|
||||
|
|
||||
= note: #[deny(clippy::derive_hash_xor_eq)] on by default
|
||||
= note: `#[deny(clippy::derive_hash_xor_eq)]` on by default
|
||||
note: `PartialEq` implemented here
|
||||
--> $DIR/derive.rs:19:1
|
||||
|
|
||||
|
|
|
@ -4,7 +4,7 @@ error: Bounds of the form `T: Drop` are useless. Use `std::mem::needs_drop` to d
|
|||
LL | fn foo<T: Drop>() {}
|
||||
| ^^^^
|
||||
|
|
||||
= note: #[deny(clippy::drop_bounds)] on by default
|
||||
= note: `#[deny(clippy::drop_bounds)]` on by default
|
||||
|
||||
error: Bounds of the form `T: Drop` are useless. Use `std::mem::needs_drop` to detect if a type has drop glue.
|
||||
--> $DIR/drop_bounds.rs:5:8
|
||||
|
|
|
@ -30,7 +30,7 @@ error: you are iterating over `Iterator::next()` which is an Option; this will c
|
|||
LL | for x in v.iter().next() {
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(clippy::iter_next_loop)] on by default
|
||||
= note: `#[deny(clippy::iter_next_loop)]` on by default
|
||||
|
||||
error: for loop over `v.iter().next().and(Some(0))`, which is an `Option`. This is more readably written as an `if let` statement.
|
||||
--> $DIR/for_loop_over_option_result.rs:31:14
|
||||
|
@ -57,7 +57,7 @@ LL | | break;
|
|||
LL | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: #[deny(clippy::never_loop)] on by default
|
||||
= note: `#[deny(clippy::never_loop)]` on by default
|
||||
|
||||
error: this loop never actually loops
|
||||
--> $DIR/for_loop_over_option_result.rs:53:5
|
||||
|
|
|
@ -236,7 +236,7 @@ error: this `if` has the same condition as a previous if
|
|||
LL | } else if true {
|
||||
| ^^^^
|
||||
|
|
||||
= note: #[deny(clippy::ifs_same_cond)] on by default
|
||||
= note: `#[deny(clippy::ifs_same_cond)]` on by default
|
||||
note: same as this
|
||||
--> $DIR/if_same_then_else.rs:235:8
|
||||
|
|
||||
|
|
|
@ -4,7 +4,7 @@ error: index out of bounds: the len is 4 but the index is 4
|
|||
LL | x[4]; // Ok, let rustc's `const_err` lint handle `usize` indexing on arrays.
|
||||
| ^^^^
|
||||
|
|
||||
= note: #[deny(const_err)] on by default
|
||||
= note: `#[deny(const_err)]` on by default
|
||||
|
||||
error: index out of bounds: the len is 4 but the index is 8
|
||||
--> $DIR/indexing_slicing.rs:19:5
|
||||
|
|
|
@ -111,7 +111,7 @@ error: infinite iteration detected
|
|||
LL | let _: HashSet<i32> = (0..).collect(); // Infinite iter
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(clippy::infinite_iter)] on by default
|
||||
= note: `#[deny(clippy::infinite_iter)]` on by default
|
||||
|
||||
error: aborting due to 15 previous errors
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ error: Variable in the condition are not mutated in the loop body. This either l
|
|||
LL | while y < 10 {
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: #[deny(clippy::while_immutable_condition)] on by default
|
||||
= note: `#[deny(clippy::while_immutable_condition)]` on by default
|
||||
|
||||
error: Variable in the condition are not mutated in the loop body. This either leads to an infinite or to a never running loop.
|
||||
--> $DIR/infinite_loop.rs:28:11
|
||||
|
|
|
@ -4,7 +4,7 @@ error: reference to zeroed memory
|
|||
LL | let ref_zero: &T = std::mem::zeroed(); // warning
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(clippy::invalid_ref)] on by default
|
||||
= note: `#[deny(clippy::invalid_ref)]` on by default
|
||||
= help: Creation of a null reference is undefined behavior; see https://doc.rust-lang.org/reference/behavior-considered-undefined.html
|
||||
|
||||
error: reference to zeroed memory
|
||||
|
|
|
@ -13,7 +13,7 @@ note: lint level defined here
|
|||
|
|
||||
LL | #![deny(clippy::internal)]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
= note: #[deny(clippy::lint_without_lint_pass)] implied by #[deny(clippy::internal)]
|
||||
= note: `#[deny(clippy::lint_without_lint_pass)]` implied by `#[deny(clippy::internal)]`
|
||||
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
|
||||
error: aborting due to previous error
|
||||
|
|
|
@ -83,7 +83,7 @@ error: equal expressions as operands to `&&`
|
|||
LL | match test && test {
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(clippy::eq_op)] on by default
|
||||
= note: `#[deny(clippy::eq_op)]` on by default
|
||||
|
||||
error: you seem to be trying to match on a boolean expression
|
||||
--> $DIR/match_bool.rs:36:5
|
||||
|
|
|
@ -4,7 +4,7 @@ error: mistyped literal suffix
|
|||
LL | let fail14 = 2_32;
|
||||
| ^^^^ help: did you mean to write: `2_i32`
|
||||
|
|
||||
= note: #[deny(clippy::mistyped_literal_suffixes)] on by default
|
||||
= note: `#[deny(clippy::mistyped_literal_suffixes)]` on by default
|
||||
|
||||
error: mistyped literal suffix
|
||||
--> $DIR/mistyped_literal_suffix.rs:7:18
|
||||
|
|
|
@ -10,7 +10,7 @@ LL | | break;
|
|||
LL | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: #[deny(clippy::never_loop)] on by default
|
||||
= note: `#[deny(clippy::never_loop)]` on by default
|
||||
|
||||
error: this loop never actually loops
|
||||
--> $DIR/never_loop.rs:32:5
|
||||
|
|
|
@ -6,7 +6,7 @@ LL | const ATOMIC: AtomicUsize = AtomicUsize::new(5); //~ ERROR interior mutable
|
|||
| |
|
||||
| help: make this a static item: `static`
|
||||
|
|
||||
= note: #[deny(clippy::declare_interior_mutable_const)] on by default
|
||||
= note: `#[deny(clippy::declare_interior_mutable_const)]` on by default
|
||||
|
||||
error: a const item should never be interior mutable
|
||||
--> $DIR/non_copy_const.rs:11:1
|
||||
|
@ -132,7 +132,7 @@ error: a const item with interior mutability should not be borrowed
|
|||
LL | ATOMIC.store(1, Ordering::SeqCst); //~ ERROR interior mutability
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: #[deny(clippy::borrow_interior_mutable_const)] on by default
|
||||
= note: `#[deny(clippy::borrow_interior_mutable_const)]` on by default
|
||||
= help: assign this const to a local or static variable, and use the variable here
|
||||
|
||||
error: a const item with interior mutability should not be borrowed
|
||||
|
|
|
@ -4,7 +4,7 @@ error: index out of bounds: the len is 0 but the index is 0
|
|||
LL | empty[0];
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: #[deny(const_err)] on by default
|
||||
= note: `#[deny(const_err)]` on by default
|
||||
|
||||
error: range is out of bounds
|
||||
--> $DIR/empty_array.rs:7:12
|
||||
|
|
|
@ -9,7 +9,7 @@ note: lint level defined here
|
|||
|
|
||||
LL | #![deny(clippy::internal)]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
= note: #[deny(clippy::outer_expn_info)] implied by #[deny(clippy::internal)]
|
||||
= note: `#[deny(clippy::outer_expn_info)]` implied by `#[deny(clippy::internal)]`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ error: approximate value of `f{32, 64}::consts::PI` found. Consider using it dir
|
|||
LL | let _x = 3.14;
|
||||
| ^^^^
|
||||
|
|
||||
= note: #[deny(clippy::approx_constant)] on by default
|
||||
= note: `#[deny(clippy::approx_constant)]` on by default
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ error: Suspicious use of binary operator in `AddAssign` impl
|
|||
LL | *self = *self - other;
|
||||
| ^
|
||||
|
|
||||
= note: #[deny(clippy::suspicious_op_assign_impl)] on by default
|
||||
= note: `#[deny(clippy::suspicious_op_assign_impl)]` on by default
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ error: using `clone` on a double-reference; this will copy the reference instead
|
|||
LL | let z: &Vec<_> = y.clone();
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(clippy::clone_double_ref)] on by default
|
||||
= note: `#[deny(clippy::clone_double_ref)]` on by default
|
||||
help: try dereferencing it
|
||||
|
|
||||
LL | let z: &Vec<_> = &(*y).clone();
|
||||
|
|
|
@ -4,7 +4,7 @@ error: equal expressions as operands to `/`
|
|||
LL | let nan = 0.0 / 0.0;
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: #[deny(clippy::eq_op)] on by default
|
||||
= note: `#[deny(clippy::eq_op)]` on by default
|
||||
|
||||
error: constant division of 0.0 with 0.0 will always result in NaN
|
||||
--> $DIR/zero_div_zero.rs:4:15
|
||||
|
|
Loading…
Reference in a new issue