allow the lint in a bunch of tests
This commit is contained in:
parent
566a365d4f
commit
05f78e530a
|
@ -3,7 +3,12 @@
|
|||
// We also check the out_of_bounds_indexing lint here, because it lints similar things and
|
||||
// we want to avoid false positives.
|
||||
#![warn(clippy::out_of_bounds_indexing)]
|
||||
#![allow(unconditional_panic, clippy::no_effect, clippy::unnecessary_operation)]
|
||||
#![allow(
|
||||
unconditional_panic,
|
||||
clippy::no_effect,
|
||||
clippy::unnecessary_operation,
|
||||
clippy::useless_vec
|
||||
)]
|
||||
|
||||
const ARR: [i32; 2] = [1, 2];
|
||||
const REF: &i32 = &ARR[idx()]; // Ok, should not produce stderr, since `suppress-restriction-lint-in-const` is set true.
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
error[E0080]: evaluation of `main::{constant#3}` failed
|
||||
--> $DIR/test.rs:31:14
|
||||
--> $DIR/test.rs:36:14
|
||||
|
|
||||
LL | const { &ARR[idx4()] }; // Ok, should not produce stderr, since `suppress-restriction-lint-in-const` is set true.
|
||||
| ^^^^^^^^^^^ index out of bounds: the length is 2 but the index is 4
|
||||
|
||||
note: erroneous constant used
|
||||
--> $DIR/test.rs:31:5
|
||||
--> $DIR/test.rs:36:5
|
||||
|
|
||||
LL | const { &ARR[idx4()] }; // Ok, should not produce stderr, since `suppress-restriction-lint-in-const` is set true.
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: indexing may panic
|
||||
--> $DIR/test.rs:22:5
|
||||
--> $DIR/test.rs:27:5
|
||||
|
|
||||
LL | x[index];
|
||||
| ^^^^^^^^
|
||||
|
@ -20,7 +20,7 @@ LL | x[index];
|
|||
= note: `-D clippy::indexing-slicing` implied by `-D warnings`
|
||||
|
||||
error: indexing may panic
|
||||
--> $DIR/test.rs:38:5
|
||||
--> $DIR/test.rs:43:5
|
||||
|
|
||||
LL | v[0];
|
||||
| ^^^^
|
||||
|
@ -28,7 +28,7 @@ LL | v[0];
|
|||
= help: consider using `.get(n)` or `.get_mut(n)` instead
|
||||
|
||||
error: indexing may panic
|
||||
--> $DIR/test.rs:39:5
|
||||
--> $DIR/test.rs:44:5
|
||||
|
|
||||
LL | v[10];
|
||||
| ^^^^^
|
||||
|
@ -36,7 +36,7 @@ LL | v[10];
|
|||
= help: consider using `.get(n)` or `.get_mut(n)` instead
|
||||
|
||||
error: indexing may panic
|
||||
--> $DIR/test.rs:40:5
|
||||
--> $DIR/test.rs:45:5
|
||||
|
|
||||
LL | v[1 << 3];
|
||||
| ^^^^^^^^^
|
||||
|
@ -44,7 +44,7 @@ LL | v[1 << 3];
|
|||
= help: consider using `.get(n)` or `.get_mut(n)` instead
|
||||
|
||||
error: indexing may panic
|
||||
--> $DIR/test.rs:46:5
|
||||
--> $DIR/test.rs:51:5
|
||||
|
|
||||
LL | v[N];
|
||||
| ^^^^
|
||||
|
@ -52,7 +52,7 @@ LL | v[N];
|
|||
= help: consider using `.get(n)` or `.get_mut(n)` instead
|
||||
|
||||
error: indexing may panic
|
||||
--> $DIR/test.rs:47:5
|
||||
--> $DIR/test.rs:52:5
|
||||
|
|
||||
LL | v[M];
|
||||
| ^^^^
|
||||
|
@ -60,7 +60,7 @@ LL | v[M];
|
|||
= help: consider using `.get(n)` or `.get_mut(n)` instead
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/test.rs:10:24
|
||||
--> $DIR/test.rs:15:24
|
||||
|
|
||||
LL | const REF_ERR: &i32 = &ARR[idx4()]; // Ok, let rustc handle const contexts.
|
||||
| ^^^^^^^^^^^ index out of bounds: the length is 2 but the index is 4
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
//@compile-flags: --crate-name conf_disallowed_methods
|
||||
|
||||
#![warn(clippy::disallowed_methods)]
|
||||
#![allow(clippy::useless_vec)]
|
||||
|
||||
extern crate futures;
|
||||
extern crate regex;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: use of a disallowed method `regex::Regex::new`
|
||||
--> $DIR/conf_disallowed_methods.rs:33:14
|
||||
--> $DIR/conf_disallowed_methods.rs:34:14
|
||||
|
|
||||
LL | let re = Regex::new(r"ab.*c").unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -7,7 +7,7 @@ LL | let re = Regex::new(r"ab.*c").unwrap();
|
|||
= note: `-D clippy::disallowed-methods` implied by `-D warnings`
|
||||
|
||||
error: use of a disallowed method `regex::Regex::is_match`
|
||||
--> $DIR/conf_disallowed_methods.rs:34:5
|
||||
--> $DIR/conf_disallowed_methods.rs:35:5
|
||||
|
|
||||
LL | re.is_match("abc");
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
@ -15,73 +15,73 @@ LL | re.is_match("abc");
|
|||
= note: no matching allowed (from clippy.toml)
|
||||
|
||||
error: use of a disallowed method `std::iter::Iterator::sum`
|
||||
--> $DIR/conf_disallowed_methods.rs:37:5
|
||||
--> $DIR/conf_disallowed_methods.rs:38:5
|
||||
|
|
||||
LL | a.iter().sum::<i32>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: use of a disallowed method `slice::sort_unstable`
|
||||
--> $DIR/conf_disallowed_methods.rs:39:5
|
||||
--> $DIR/conf_disallowed_methods.rs:40:5
|
||||
|
|
||||
LL | a.sort_unstable();
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: use of a disallowed method `f32::clamp`
|
||||
--> $DIR/conf_disallowed_methods.rs:41:13
|
||||
--> $DIR/conf_disallowed_methods.rs:42:13
|
||||
|
|
||||
LL | let _ = 2.0f32.clamp(3.0f32, 4.0f32);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: use of a disallowed method `regex::Regex::new`
|
||||
--> $DIR/conf_disallowed_methods.rs:44:61
|
||||
--> $DIR/conf_disallowed_methods.rs:45:61
|
||||
|
|
||||
LL | let indirect: fn(&str) -> Result<Regex, regex::Error> = Regex::new;
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: use of a disallowed method `f32::clamp`
|
||||
--> $DIR/conf_disallowed_methods.rs:47:28
|
||||
--> $DIR/conf_disallowed_methods.rs:48:28
|
||||
|
|
||||
LL | let in_call = Box::new(f32::clamp);
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: use of a disallowed method `regex::Regex::new`
|
||||
--> $DIR/conf_disallowed_methods.rs:48:53
|
||||
--> $DIR/conf_disallowed_methods.rs:49:53
|
||||
|
|
||||
LL | let in_method_call = ["^", "$"].into_iter().map(Regex::new);
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: use of a disallowed method `futures::stream::select_all`
|
||||
--> $DIR/conf_disallowed_methods.rs:51:31
|
||||
--> $DIR/conf_disallowed_methods.rs:52:31
|
||||
|
|
||||
LL | let same_name_as_module = select_all(vec![empty::<()>()]);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: use of a disallowed method `conf_disallowed_methods::local_fn`
|
||||
--> $DIR/conf_disallowed_methods.rs:53:5
|
||||
--> $DIR/conf_disallowed_methods.rs:54:5
|
||||
|
|
||||
LL | local_fn();
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: use of a disallowed method `conf_disallowed_methods::local_mod::f`
|
||||
--> $DIR/conf_disallowed_methods.rs:54:5
|
||||
--> $DIR/conf_disallowed_methods.rs:55:5
|
||||
|
|
||||
LL | local_mod::f();
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: use of a disallowed method `conf_disallowed_methods::Struct::method`
|
||||
--> $DIR/conf_disallowed_methods.rs:56:5
|
||||
--> $DIR/conf_disallowed_methods.rs:57:5
|
||||
|
|
||||
LL | s.method();
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: use of a disallowed method `conf_disallowed_methods::Trait::provided_method`
|
||||
--> $DIR/conf_disallowed_methods.rs:57:5
|
||||
--> $DIR/conf_disallowed_methods.rs:58:5
|
||||
|
|
||||
LL | s.provided_method();
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: use of a disallowed method `conf_disallowed_methods::Trait::implemented_method`
|
||||
--> $DIR/conf_disallowed_methods.rs:58:5
|
||||
--> $DIR/conf_disallowed_methods.rs:59:5
|
||||
|
|
||||
LL | s.implemented_method();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
//@compile-flags: --test
|
||||
|
||||
#![allow(unused_mut, clippy::get_first, clippy::from_iter_instead_of_collect)]
|
||||
#![allow(
|
||||
unused_mut,
|
||||
clippy::get_first,
|
||||
clippy::from_iter_instead_of_collect,
|
||||
clippy::useless_vec
|
||||
)]
|
||||
#![warn(clippy::unwrap_used)]
|
||||
#![deny(clippy::get_unwrap)]
|
||||
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise
|
||||
--> $DIR/unwrap_used.rs:35:17
|
||||
--> $DIR/unwrap_used.rs:40:17
|
||||
|
|
||||
LL | let _ = boxed_slice.get(1).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&boxed_slice[1]`
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/unwrap_used.rs:5:9
|
||||
--> $DIR/unwrap_used.rs:10:9
|
||||
|
|
||||
LL | #![deny(clippy::get_unwrap)]
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/unwrap_used.rs:35:17
|
||||
--> $DIR/unwrap_used.rs:40:17
|
||||
|
|
||||
LL | let _ = boxed_slice.get(1).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -20,13 +20,13 @@ LL | let _ = boxed_slice.get(1).unwrap();
|
|||
= note: `-D clippy::unwrap-used` implied by `-D warnings`
|
||||
|
||||
error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise
|
||||
--> $DIR/unwrap_used.rs:36:17
|
||||
--> $DIR/unwrap_used.rs:41:17
|
||||
|
|
||||
LL | let _ = some_slice.get(0).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_slice[0]`
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/unwrap_used.rs:36:17
|
||||
--> $DIR/unwrap_used.rs:41:17
|
||||
|
|
||||
LL | let _ = some_slice.get(0).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -34,13 +34,13 @@ LL | let _ = some_slice.get(0).unwrap();
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get().unwrap()` on a Vec. Using `[]` is more clear and more concise
|
||||
--> $DIR/unwrap_used.rs:37:17
|
||||
--> $DIR/unwrap_used.rs:42:17
|
||||
|
|
||||
LL | let _ = some_vec.get(0).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_vec[0]`
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/unwrap_used.rs:37:17
|
||||
--> $DIR/unwrap_used.rs:42:17
|
||||
|
|
||||
LL | let _ = some_vec.get(0).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -48,13 +48,13 @@ LL | let _ = some_vec.get(0).unwrap();
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get().unwrap()` on a VecDeque. Using `[]` is more clear and more concise
|
||||
--> $DIR/unwrap_used.rs:38:17
|
||||
--> $DIR/unwrap_used.rs:43:17
|
||||
|
|
||||
LL | let _ = some_vecdeque.get(0).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_vecdeque[0]`
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/unwrap_used.rs:38:17
|
||||
--> $DIR/unwrap_used.rs:43:17
|
||||
|
|
||||
LL | let _ = some_vecdeque.get(0).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -62,13 +62,13 @@ LL | let _ = some_vecdeque.get(0).unwrap();
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get().unwrap()` on a HashMap. Using `[]` is more clear and more concise
|
||||
--> $DIR/unwrap_used.rs:39:17
|
||||
--> $DIR/unwrap_used.rs:44:17
|
||||
|
|
||||
LL | let _ = some_hashmap.get(&1).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_hashmap[&1]`
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/unwrap_used.rs:39:17
|
||||
--> $DIR/unwrap_used.rs:44:17
|
||||
|
|
||||
LL | let _ = some_hashmap.get(&1).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -76,13 +76,13 @@ LL | let _ = some_hashmap.get(&1).unwrap();
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get().unwrap()` on a BTreeMap. Using `[]` is more clear and more concise
|
||||
--> $DIR/unwrap_used.rs:40:17
|
||||
--> $DIR/unwrap_used.rs:45:17
|
||||
|
|
||||
LL | let _ = some_btreemap.get(&1).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_btreemap[&1]`
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/unwrap_used.rs:40:17
|
||||
--> $DIR/unwrap_used.rs:45:17
|
||||
|
|
||||
LL | let _ = some_btreemap.get(&1).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -90,13 +90,13 @@ LL | let _ = some_btreemap.get(&1).unwrap();
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise
|
||||
--> $DIR/unwrap_used.rs:44:21
|
||||
--> $DIR/unwrap_used.rs:49:21
|
||||
|
|
||||
LL | let _: u8 = *boxed_slice.get(1).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `boxed_slice[1]`
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/unwrap_used.rs:44:22
|
||||
--> $DIR/unwrap_used.rs:49:22
|
||||
|
|
||||
LL | let _: u8 = *boxed_slice.get(1).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -104,13 +104,13 @@ LL | let _: u8 = *boxed_slice.get(1).unwrap();
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get_mut().unwrap()` on a slice. Using `[]` is more clear and more concise
|
||||
--> $DIR/unwrap_used.rs:49:9
|
||||
--> $DIR/unwrap_used.rs:54:9
|
||||
|
|
||||
LL | *boxed_slice.get_mut(0).unwrap() = 1;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `boxed_slice[0]`
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/unwrap_used.rs:49:10
|
||||
--> $DIR/unwrap_used.rs:54:10
|
||||
|
|
||||
LL | *boxed_slice.get_mut(0).unwrap() = 1;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -118,13 +118,13 @@ LL | *boxed_slice.get_mut(0).unwrap() = 1;
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get_mut().unwrap()` on a slice. Using `[]` is more clear and more concise
|
||||
--> $DIR/unwrap_used.rs:50:9
|
||||
--> $DIR/unwrap_used.rs:55:9
|
||||
|
|
||||
LL | *some_slice.get_mut(0).unwrap() = 1;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `some_slice[0]`
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/unwrap_used.rs:50:10
|
||||
--> $DIR/unwrap_used.rs:55:10
|
||||
|
|
||||
LL | *some_slice.get_mut(0).unwrap() = 1;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -132,13 +132,13 @@ LL | *some_slice.get_mut(0).unwrap() = 1;
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get_mut().unwrap()` on a Vec. Using `[]` is more clear and more concise
|
||||
--> $DIR/unwrap_used.rs:51:9
|
||||
--> $DIR/unwrap_used.rs:56:9
|
||||
|
|
||||
LL | *some_vec.get_mut(0).unwrap() = 1;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `some_vec[0]`
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/unwrap_used.rs:51:10
|
||||
--> $DIR/unwrap_used.rs:56:10
|
||||
|
|
||||
LL | *some_vec.get_mut(0).unwrap() = 1;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -146,13 +146,13 @@ LL | *some_vec.get_mut(0).unwrap() = 1;
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get_mut().unwrap()` on a VecDeque. Using `[]` is more clear and more concise
|
||||
--> $DIR/unwrap_used.rs:52:9
|
||||
--> $DIR/unwrap_used.rs:57:9
|
||||
|
|
||||
LL | *some_vecdeque.get_mut(0).unwrap() = 1;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `some_vecdeque[0]`
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/unwrap_used.rs:52:10
|
||||
--> $DIR/unwrap_used.rs:57:10
|
||||
|
|
||||
LL | *some_vecdeque.get_mut(0).unwrap() = 1;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -160,13 +160,13 @@ LL | *some_vecdeque.get_mut(0).unwrap() = 1;
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get().unwrap()` on a Vec. Using `[]` is more clear and more concise
|
||||
--> $DIR/unwrap_used.rs:64:17
|
||||
--> $DIR/unwrap_used.rs:69:17
|
||||
|
|
||||
LL | let _ = some_vec.get(0..1).unwrap().to_vec();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `some_vec[0..1]`
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/unwrap_used.rs:64:17
|
||||
--> $DIR/unwrap_used.rs:69:17
|
||||
|
|
||||
LL | let _ = some_vec.get(0..1).unwrap().to_vec();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -174,13 +174,13 @@ LL | let _ = some_vec.get(0..1).unwrap().to_vec();
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get_mut().unwrap()` on a Vec. Using `[]` is more clear and more concise
|
||||
--> $DIR/unwrap_used.rs:65:17
|
||||
--> $DIR/unwrap_used.rs:70:17
|
||||
|
|
||||
LL | let _ = some_vec.get_mut(0..1).unwrap().to_vec();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `some_vec[0..1]`
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/unwrap_used.rs:65:17
|
||||
--> $DIR/unwrap_used.rs:70:17
|
||||
|
|
||||
LL | let _ = some_vec.get_mut(0..1).unwrap().to_vec();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -188,13 +188,13 @@ LL | let _ = some_vec.get_mut(0..1).unwrap().to_vec();
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise
|
||||
--> $DIR/unwrap_used.rs:72:13
|
||||
--> $DIR/unwrap_used.rs:77:13
|
||||
|
|
||||
LL | let _ = boxed_slice.get(1).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&boxed_slice[1]`
|
||||
|
||||
error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise
|
||||
--> $DIR/unwrap_used.rs:90:17
|
||||
--> $DIR/unwrap_used.rs:95:17
|
||||
|
|
||||
LL | let _ = Box::new([0]).get(1).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&Box::new([0])[1]`
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use core::num::Wrapping;
|
||||
|
||||
#[allow(dead_code, unused_assignments)]
|
||||
#[allow(dead_code, unused_assignments, clippy::useless_vec)]
|
||||
#[warn(clippy::assign_op_pattern)]
|
||||
fn main() {
|
||||
let mut a = 5;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use core::num::Wrapping;
|
||||
|
||||
#[allow(dead_code, unused_assignments)]
|
||||
#[allow(dead_code, unused_assignments, clippy::useless_vec)]
|
||||
#[warn(clippy::assign_op_pattern)]
|
||||
fn main() {
|
||||
let mut a = 5;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#![allow(clippy::needless_borrow)]
|
||||
#![allow(clippy::needless_borrow, clippy::useless_vec)]
|
||||
|
||||
#[deny(clippy::naive_bytecount)]
|
||||
fn main() {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#![allow(unused)]
|
||||
#![allow(unused, clippy::useless_vec)]
|
||||
#![warn(clippy::collection_is_never_read)]
|
||||
|
||||
use std::collections::{HashMap, HashSet};
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
//@run-rustfix
|
||||
|
||||
#![warn(clippy::comparison_to_empty)]
|
||||
#![allow(clippy::useless_vec)]
|
||||
|
||||
fn main() {
|
||||
// Disallow comparisons to empty
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
//@run-rustfix
|
||||
|
||||
#![warn(clippy::comparison_to_empty)]
|
||||
#![allow(clippy::useless_vec)]
|
||||
|
||||
fn main() {
|
||||
// Disallow comparisons to empty
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: comparison to empty slice
|
||||
--> $DIR/comparison_to_empty.rs:8:13
|
||||
--> $DIR/comparison_to_empty.rs:9:13
|
||||
|
|
||||
LL | let _ = s == "";
|
||||
| ^^^^^^^ help: using `is_empty` is clearer and more explicit: `s.is_empty()`
|
||||
|
@ -7,19 +7,19 @@ LL | let _ = s == "";
|
|||
= note: `-D clippy::comparison-to-empty` implied by `-D warnings`
|
||||
|
||||
error: comparison to empty slice
|
||||
--> $DIR/comparison_to_empty.rs:9:13
|
||||
--> $DIR/comparison_to_empty.rs:10:13
|
||||
|
|
||||
LL | let _ = s != "";
|
||||
| ^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!s.is_empty()`
|
||||
|
||||
error: comparison to empty slice
|
||||
--> $DIR/comparison_to_empty.rs:12:13
|
||||
--> $DIR/comparison_to_empty.rs:13:13
|
||||
|
|
||||
LL | let _ = v == [];
|
||||
| ^^^^^^^ help: using `is_empty` is clearer and more explicit: `v.is_empty()`
|
||||
|
||||
error: comparison to empty slice
|
||||
--> $DIR/comparison_to_empty.rs:13:13
|
||||
--> $DIR/comparison_to_empty.rs:14:13
|
||||
|
|
||||
LL | let _ = v != [];
|
||||
| ^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!v.is_empty()`
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//@run-rustfix
|
||||
//@aux-build:proc_macros.rs
|
||||
|
||||
#![allow(clippy::return_self_not_must_use)]
|
||||
#![allow(clippy::return_self_not_must_use, clippy::useless_vec)]
|
||||
#![warn(clippy::deref_addrof)]
|
||||
|
||||
extern crate proc_macros;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//@run-rustfix
|
||||
//@aux-build:proc_macros.rs
|
||||
|
||||
#![allow(clippy::return_self_not_must_use)]
|
||||
#![allow(clippy::return_self_not_must_use, clippy::useless_vec)]
|
||||
#![warn(clippy::deref_addrof)]
|
||||
|
||||
extern crate proc_macros;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#![warn(clippy::eq_op)]
|
||||
#![allow(clippy::useless_vec)]
|
||||
|
||||
// lint also in macro definition
|
||||
macro_rules! assert_in_macro_def {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: identical args used in this `assert_eq!` macro call
|
||||
--> $DIR/eq_op_macros.rs:7:20
|
||||
--> $DIR/eq_op_macros.rs:8:20
|
||||
|
|
||||
LL | assert_eq!(a, a);
|
||||
| ^^^^
|
||||
|
@ -11,7 +11,7 @@ LL | assert_in_macro_def!();
|
|||
= note: this error originates in the macro `assert_in_macro_def` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: identical args used in this `assert_ne!` macro call
|
||||
--> $DIR/eq_op_macros.rs:8:20
|
||||
--> $DIR/eq_op_macros.rs:9:20
|
||||
|
|
||||
LL | assert_ne!(a, a);
|
||||
| ^^^^
|
||||
|
@ -22,7 +22,7 @@ LL | assert_in_macro_def!();
|
|||
= note: this error originates in the macro `assert_in_macro_def` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: identical args used in this `debug_assert_eq!` macro call
|
||||
--> $DIR/eq_op_macros.rs:9:26
|
||||
--> $DIR/eq_op_macros.rs:10:26
|
||||
|
|
||||
LL | debug_assert_eq!(a, a);
|
||||
| ^^^^
|
||||
|
@ -33,7 +33,7 @@ LL | assert_in_macro_def!();
|
|||
= note: this error originates in the macro `assert_in_macro_def` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: identical args used in this `debug_assert_ne!` macro call
|
||||
--> $DIR/eq_op_macros.rs:10:26
|
||||
--> $DIR/eq_op_macros.rs:11:26
|
||||
|
|
||||
LL | debug_assert_ne!(a, a);
|
||||
| ^^^^
|
||||
|
@ -44,49 +44,49 @@ LL | assert_in_macro_def!();
|
|||
= note: this error originates in the macro `assert_in_macro_def` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: identical args used in this `assert_eq!` macro call
|
||||
--> $DIR/eq_op_macros.rs:22:16
|
||||
--> $DIR/eq_op_macros.rs:23:16
|
||||
|
|
||||
LL | assert_eq!(a, a);
|
||||
| ^^^^
|
||||
|
||||
error: identical args used in this `assert_eq!` macro call
|
||||
--> $DIR/eq_op_macros.rs:23:16
|
||||
--> $DIR/eq_op_macros.rs:24:16
|
||||
|
|
||||
LL | assert_eq!(a + 1, a + 1);
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: identical args used in this `assert_ne!` macro call
|
||||
--> $DIR/eq_op_macros.rs:30:16
|
||||
--> $DIR/eq_op_macros.rs:31:16
|
||||
|
|
||||
LL | assert_ne!(a, a);
|
||||
| ^^^^
|
||||
|
||||
error: identical args used in this `assert_ne!` macro call
|
||||
--> $DIR/eq_op_macros.rs:31:16
|
||||
--> $DIR/eq_op_macros.rs:32:16
|
||||
|
|
||||
LL | assert_ne!(a + 1, a + 1);
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: identical args used in this `debug_assert_eq!` macro call
|
||||
--> $DIR/eq_op_macros.rs:38:22
|
||||
--> $DIR/eq_op_macros.rs:39:22
|
||||
|
|
||||
LL | debug_assert_eq!(a, a);
|
||||
| ^^^^
|
||||
|
||||
error: identical args used in this `debug_assert_eq!` macro call
|
||||
--> $DIR/eq_op_macros.rs:39:22
|
||||
--> $DIR/eq_op_macros.rs:40:22
|
||||
|
|
||||
LL | debug_assert_eq!(a + 1, a + 1);
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: identical args used in this `debug_assert_ne!` macro call
|
||||
--> $DIR/eq_op_macros.rs:46:22
|
||||
--> $DIR/eq_op_macros.rs:47:22
|
||||
|
|
||||
LL | debug_assert_ne!(a, a);
|
||||
| ^^^^
|
||||
|
||||
error: identical args used in this `debug_assert_ne!` macro call
|
||||
--> $DIR/eq_op_macros.rs:47:22
|
||||
--> $DIR/eq_op_macros.rs:48:22
|
||||
|
|
||||
LL | debug_assert_ne!(a + 1, a + 1);
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//@run-rustfix
|
||||
#![warn(clippy::excessive_precision)]
|
||||
#![allow(dead_code, unused_variables, clippy::print_literal)]
|
||||
#![allow(dead_code, unused_variables, clippy::print_literal, clippy::useless_vec)]
|
||||
|
||||
fn main() {
|
||||
// Consts
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//@run-rustfix
|
||||
#![warn(clippy::excessive_precision)]
|
||||
#![allow(dead_code, unused_variables, clippy::print_literal)]
|
||||
#![allow(dead_code, unused_variables, clippy::print_literal, clippy::useless_vec)]
|
||||
|
||||
fn main() {
|
||||
// Consts
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#![warn(clippy::explicit_counter_loop)]
|
||||
#![allow(clippy::uninlined_format_args)]
|
||||
#![allow(clippy::uninlined_format_args, clippy::useless_vec)]
|
||||
|
||||
fn main() {
|
||||
let mut vec = vec![1, 2, 3, 4];
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#![warn(clippy::all, clippy::pedantic)]
|
||||
#![allow(clippy::useless_vec)]
|
||||
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
enum Flavor {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//@run-rustfix
|
||||
#![allow(dead_code, unused)]
|
||||
#![allow(clippy::uninlined_format_args)]
|
||||
#![allow(clippy::uninlined_format_args, clippy::useless_vec)]
|
||||
|
||||
use std::collections::*;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//@run-rustfix
|
||||
#![allow(dead_code, unused)]
|
||||
#![allow(clippy::uninlined_format_args)]
|
||||
#![allow(clippy::uninlined_format_args, clippy::useless_vec)]
|
||||
|
||||
use std::collections::*;
|
||||
|
||||
|
|
|
@ -7,7 +7,12 @@
|
|||
clippy::iter_next_loop,
|
||||
clippy::for_kv_map
|
||||
)]
|
||||
#[allow(clippy::linkedlist, clippy::unnecessary_mut_passed, clippy::similar_names)]
|
||||
#[allow(
|
||||
clippy::linkedlist,
|
||||
clippy::unnecessary_mut_passed,
|
||||
clippy::similar_names,
|
||||
clippy::useless_vec
|
||||
)]
|
||||
#[allow(for_loops_over_fallibles)]
|
||||
fn main() {
|
||||
let vec = vec![1, 2, 3, 4];
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: you are iterating over `Iterator::next()` which is an Option; this will compile but is probably not what you want
|
||||
--> $DIR/for_loop_unfixable.rs:15:15
|
||||
--> $DIR/for_loop_unfixable.rs:20:15
|
||||
|
|
||||
LL | for _v in vec.iter().next() {}
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
clippy::redundant_clone,
|
||||
clippy::to_string_in_format_args,
|
||||
clippy::needless_borrow,
|
||||
clippy::uninlined_format_args
|
||||
clippy::uninlined_format_args,
|
||||
clippy::useless_vec
|
||||
)]
|
||||
|
||||
struct Foo(pub String);
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
clippy::redundant_clone,
|
||||
clippy::to_string_in_format_args,
|
||||
clippy::needless_borrow,
|
||||
clippy::uninlined_format_args
|
||||
clippy::uninlined_format_args,
|
||||
clippy::useless_vec
|
||||
)]
|
||||
|
||||
struct Foo(pub String);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: useless use of `format!`
|
||||
--> $DIR/format.rs:19:5
|
||||
--> $DIR/format.rs:20:5
|
||||
|
|
||||
LL | format!("foo");
|
||||
| ^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"foo".to_string()`
|
||||
|
@ -7,19 +7,19 @@ LL | format!("foo");
|
|||
= note: `-D clippy::useless-format` implied by `-D warnings`
|
||||
|
||||
error: useless use of `format!`
|
||||
--> $DIR/format.rs:20:5
|
||||
--> $DIR/format.rs:21:5
|
||||
|
|
||||
LL | format!("{{}}");
|
||||
| ^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"{}".to_string()`
|
||||
|
||||
error: useless use of `format!`
|
||||
--> $DIR/format.rs:21:5
|
||||
--> $DIR/format.rs:22:5
|
||||
|
|
||||
LL | format!("{{}} abc {{}}");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"{} abc {}".to_string()`
|
||||
|
||||
error: useless use of `format!`
|
||||
--> $DIR/format.rs:22:5
|
||||
--> $DIR/format.rs:23:5
|
||||
|
|
||||
LL | / format!(
|
||||
LL | | r##"foo {{}}
|
||||
|
@ -34,67 +34,67 @@ LL ~ " bar"##.to_string();
|
|||
|
|
||||
|
||||
error: useless use of `format!`
|
||||
--> $DIR/format.rs:27:13
|
||||
--> $DIR/format.rs:28:13
|
||||
|
|
||||
LL | let _ = format!("");
|
||||
| ^^^^^^^^^^^ help: consider using `String::new()`: `String::new()`
|
||||
|
||||
error: useless use of `format!`
|
||||
--> $DIR/format.rs:29:5
|
||||
--> $DIR/format.rs:30:5
|
||||
|
|
||||
LL | format!("{}", "foo");
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"foo".to_string()`
|
||||
|
||||
error: useless use of `format!`
|
||||
--> $DIR/format.rs:37:5
|
||||
--> $DIR/format.rs:38:5
|
||||
|
|
||||
LL | format!("{}", arg);
|
||||
| ^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `arg.to_string()`
|
||||
|
||||
error: useless use of `format!`
|
||||
--> $DIR/format.rs:67:5
|
||||
--> $DIR/format.rs:68:5
|
||||
|
|
||||
LL | format!("{}", 42.to_string());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `42.to_string()`
|
||||
|
||||
error: useless use of `format!`
|
||||
--> $DIR/format.rs:69:5
|
||||
--> $DIR/format.rs:70:5
|
||||
|
|
||||
LL | format!("{}", x.display().to_string());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `x.display().to_string()`
|
||||
|
||||
error: useless use of `format!`
|
||||
--> $DIR/format.rs:73:18
|
||||
--> $DIR/format.rs:74:18
|
||||
|
|
||||
LL | let _ = Some(format!("{}", a + "bar"));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `a + "bar"`
|
||||
|
||||
error: useless use of `format!`
|
||||
--> $DIR/format.rs:77:22
|
||||
--> $DIR/format.rs:78:22
|
||||
|
|
||||
LL | let _s: String = format!("{}", &*v.join("/n"));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `(&*v.join("/n")).to_string()`
|
||||
|
||||
error: useless use of `format!`
|
||||
--> $DIR/format.rs:83:13
|
||||
--> $DIR/format.rs:84:13
|
||||
|
|
||||
LL | let _ = format!("{x}");
|
||||
| ^^^^^^^^^^^^^^ help: consider using `.to_string()`: `x.to_string()`
|
||||
|
||||
error: useless use of `format!`
|
||||
--> $DIR/format.rs:85:13
|
||||
--> $DIR/format.rs:86:13
|
||||
|
|
||||
LL | let _ = format!("{y}", y = x);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `x.to_string()`
|
||||
|
||||
error: useless use of `format!`
|
||||
--> $DIR/format.rs:89:13
|
||||
--> $DIR/format.rs:90:13
|
||||
|
|
||||
LL | let _ = format!("{abc}");
|
||||
| ^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `abc.to_string()`
|
||||
|
||||
error: useless use of `format!`
|
||||
--> $DIR/format.rs:91:13
|
||||
--> $DIR/format.rs:92:13
|
||||
|
|
||||
LL | let _ = format!("{xx}");
|
||||
| ^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `xx.to_string()`
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
//@run-rustfix
|
||||
#![warn(clippy::get_first)]
|
||||
#![allow(clippy::useless_vec)]
|
||||
use std::collections::BTreeMap;
|
||||
use std::collections::HashMap;
|
||||
use std::collections::VecDeque;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
//@run-rustfix
|
||||
#![warn(clippy::get_first)]
|
||||
#![allow(clippy::useless_vec)]
|
||||
use std::collections::BTreeMap;
|
||||
use std::collections::HashMap;
|
||||
use std::collections::VecDeque;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: accessing first element with `x.get(0)`
|
||||
--> $DIR/get_first.rs:19:13
|
||||
--> $DIR/get_first.rs:20:13
|
||||
|
|
||||
LL | let _ = x.get(0); // Use x.first()
|
||||
| ^^^^^^^^ help: try: `x.first()`
|
||||
|
@ -7,13 +7,13 @@ LL | let _ = x.get(0); // Use x.first()
|
|||
= note: `-D clippy::get-first` implied by `-D warnings`
|
||||
|
||||
error: accessing first element with `y.get(0)`
|
||||
--> $DIR/get_first.rs:24:13
|
||||
--> $DIR/get_first.rs:25:13
|
||||
|
|
||||
LL | let _ = y.get(0); // Use y.first()
|
||||
| ^^^^^^^^ help: try: `y.first()`
|
||||
|
||||
error: accessing first element with `z.get(0)`
|
||||
--> $DIR/get_first.rs:29:13
|
||||
--> $DIR/get_first.rs:30:13
|
||||
|
|
||||
LL | let _ = z.get(0); // Use z.first()
|
||||
| ^^^^^^^^ help: try: `z.first()`
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//@run-rustfix
|
||||
|
||||
#![warn(clippy::get_last_with_len)]
|
||||
#![allow(unused)]
|
||||
#![allow(unused, clippy::useless_vec)]
|
||||
|
||||
use std::collections::VecDeque;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//@run-rustfix
|
||||
|
||||
#![warn(clippy::get_last_with_len)]
|
||||
#![allow(unused)]
|
||||
#![allow(unused, clippy::useless_vec)]
|
||||
|
||||
use std::collections::VecDeque;
|
||||
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
//@run-rustfix
|
||||
|
||||
#![allow(unused_mut, clippy::from_iter_instead_of_collect, clippy::get_first)]
|
||||
#![allow(
|
||||
unused_mut,
|
||||
clippy::from_iter_instead_of_collect,
|
||||
clippy::get_first,
|
||||
clippy::useless_vec
|
||||
)]
|
||||
#![warn(clippy::unwrap_used)]
|
||||
#![deny(clippy::get_unwrap)]
|
||||
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
//@run-rustfix
|
||||
|
||||
#![allow(unused_mut, clippy::from_iter_instead_of_collect, clippy::get_first)]
|
||||
#![allow(
|
||||
unused_mut,
|
||||
clippy::from_iter_instead_of_collect,
|
||||
clippy::get_first,
|
||||
clippy::useless_vec
|
||||
)]
|
||||
#![warn(clippy::unwrap_used)]
|
||||
#![deny(clippy::get_unwrap)]
|
||||
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise
|
||||
--> $DIR/get_unwrap.rs:35:17
|
||||
--> $DIR/get_unwrap.rs:40:17
|
||||
|
|
||||
LL | let _ = boxed_slice.get(1).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&boxed_slice[1]`
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/get_unwrap.rs:5:9
|
||||
--> $DIR/get_unwrap.rs:10:9
|
||||
|
|
||||
LL | #![deny(clippy::get_unwrap)]
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/get_unwrap.rs:35:17
|
||||
--> $DIR/get_unwrap.rs:40:17
|
||||
|
|
||||
LL | let _ = boxed_slice.get(1).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -20,13 +20,13 @@ LL | let _ = boxed_slice.get(1).unwrap();
|
|||
= note: `-D clippy::unwrap-used` implied by `-D warnings`
|
||||
|
||||
error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise
|
||||
--> $DIR/get_unwrap.rs:36:17
|
||||
--> $DIR/get_unwrap.rs:41:17
|
||||
|
|
||||
LL | let _ = some_slice.get(0).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_slice[0]`
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/get_unwrap.rs:36:17
|
||||
--> $DIR/get_unwrap.rs:41:17
|
||||
|
|
||||
LL | let _ = some_slice.get(0).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -34,13 +34,13 @@ LL | let _ = some_slice.get(0).unwrap();
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get().unwrap()` on a Vec. Using `[]` is more clear and more concise
|
||||
--> $DIR/get_unwrap.rs:37:17
|
||||
--> $DIR/get_unwrap.rs:42:17
|
||||
|
|
||||
LL | let _ = some_vec.get(0).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_vec[0]`
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/get_unwrap.rs:37:17
|
||||
--> $DIR/get_unwrap.rs:42:17
|
||||
|
|
||||
LL | let _ = some_vec.get(0).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -48,13 +48,13 @@ LL | let _ = some_vec.get(0).unwrap();
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get().unwrap()` on a VecDeque. Using `[]` is more clear and more concise
|
||||
--> $DIR/get_unwrap.rs:38:17
|
||||
--> $DIR/get_unwrap.rs:43:17
|
||||
|
|
||||
LL | let _ = some_vecdeque.get(0).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_vecdeque[0]`
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/get_unwrap.rs:38:17
|
||||
--> $DIR/get_unwrap.rs:43:17
|
||||
|
|
||||
LL | let _ = some_vecdeque.get(0).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -62,13 +62,13 @@ LL | let _ = some_vecdeque.get(0).unwrap();
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get().unwrap()` on a HashMap. Using `[]` is more clear and more concise
|
||||
--> $DIR/get_unwrap.rs:39:17
|
||||
--> $DIR/get_unwrap.rs:44:17
|
||||
|
|
||||
LL | let _ = some_hashmap.get(&1).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_hashmap[&1]`
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/get_unwrap.rs:39:17
|
||||
--> $DIR/get_unwrap.rs:44:17
|
||||
|
|
||||
LL | let _ = some_hashmap.get(&1).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -76,13 +76,13 @@ LL | let _ = some_hashmap.get(&1).unwrap();
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get().unwrap()` on a BTreeMap. Using `[]` is more clear and more concise
|
||||
--> $DIR/get_unwrap.rs:40:17
|
||||
--> $DIR/get_unwrap.rs:45:17
|
||||
|
|
||||
LL | let _ = some_btreemap.get(&1).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&some_btreemap[&1]`
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/get_unwrap.rs:40:17
|
||||
--> $DIR/get_unwrap.rs:45:17
|
||||
|
|
||||
LL | let _ = some_btreemap.get(&1).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -90,13 +90,13 @@ LL | let _ = some_btreemap.get(&1).unwrap();
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise
|
||||
--> $DIR/get_unwrap.rs:44:21
|
||||
--> $DIR/get_unwrap.rs:49:21
|
||||
|
|
||||
LL | let _: u8 = *boxed_slice.get(1).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `boxed_slice[1]`
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/get_unwrap.rs:44:22
|
||||
--> $DIR/get_unwrap.rs:49:22
|
||||
|
|
||||
LL | let _: u8 = *boxed_slice.get(1).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -104,13 +104,13 @@ LL | let _: u8 = *boxed_slice.get(1).unwrap();
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get_mut().unwrap()` on a slice. Using `[]` is more clear and more concise
|
||||
--> $DIR/get_unwrap.rs:49:9
|
||||
--> $DIR/get_unwrap.rs:54:9
|
||||
|
|
||||
LL | *boxed_slice.get_mut(0).unwrap() = 1;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `boxed_slice[0]`
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/get_unwrap.rs:49:10
|
||||
--> $DIR/get_unwrap.rs:54:10
|
||||
|
|
||||
LL | *boxed_slice.get_mut(0).unwrap() = 1;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -118,13 +118,13 @@ LL | *boxed_slice.get_mut(0).unwrap() = 1;
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get_mut().unwrap()` on a slice. Using `[]` is more clear and more concise
|
||||
--> $DIR/get_unwrap.rs:50:9
|
||||
--> $DIR/get_unwrap.rs:55:9
|
||||
|
|
||||
LL | *some_slice.get_mut(0).unwrap() = 1;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `some_slice[0]`
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/get_unwrap.rs:50:10
|
||||
--> $DIR/get_unwrap.rs:55:10
|
||||
|
|
||||
LL | *some_slice.get_mut(0).unwrap() = 1;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -132,13 +132,13 @@ LL | *some_slice.get_mut(0).unwrap() = 1;
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get_mut().unwrap()` on a Vec. Using `[]` is more clear and more concise
|
||||
--> $DIR/get_unwrap.rs:51:9
|
||||
--> $DIR/get_unwrap.rs:56:9
|
||||
|
|
||||
LL | *some_vec.get_mut(0).unwrap() = 1;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `some_vec[0]`
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/get_unwrap.rs:51:10
|
||||
--> $DIR/get_unwrap.rs:56:10
|
||||
|
|
||||
LL | *some_vec.get_mut(0).unwrap() = 1;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -146,13 +146,13 @@ LL | *some_vec.get_mut(0).unwrap() = 1;
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get_mut().unwrap()` on a VecDeque. Using `[]` is more clear and more concise
|
||||
--> $DIR/get_unwrap.rs:52:9
|
||||
--> $DIR/get_unwrap.rs:57:9
|
||||
|
|
||||
LL | *some_vecdeque.get_mut(0).unwrap() = 1;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `some_vecdeque[0]`
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/get_unwrap.rs:52:10
|
||||
--> $DIR/get_unwrap.rs:57:10
|
||||
|
|
||||
LL | *some_vecdeque.get_mut(0).unwrap() = 1;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -160,13 +160,13 @@ LL | *some_vecdeque.get_mut(0).unwrap() = 1;
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get().unwrap()` on a Vec. Using `[]` is more clear and more concise
|
||||
--> $DIR/get_unwrap.rs:64:17
|
||||
--> $DIR/get_unwrap.rs:69:17
|
||||
|
|
||||
LL | let _ = some_vec.get(0..1).unwrap().to_vec();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `some_vec[0..1]`
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/get_unwrap.rs:64:17
|
||||
--> $DIR/get_unwrap.rs:69:17
|
||||
|
|
||||
LL | let _ = some_vec.get(0..1).unwrap().to_vec();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -174,13 +174,13 @@ LL | let _ = some_vec.get(0..1).unwrap().to_vec();
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get_mut().unwrap()` on a Vec. Using `[]` is more clear and more concise
|
||||
--> $DIR/get_unwrap.rs:65:17
|
||||
--> $DIR/get_unwrap.rs:70:17
|
||||
|
|
||||
LL | let _ = some_vec.get_mut(0..1).unwrap().to_vec();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `some_vec[0..1]`
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/get_unwrap.rs:65:17
|
||||
--> $DIR/get_unwrap.rs:70:17
|
||||
|
|
||||
LL | let _ = some_vec.get_mut(0..1).unwrap().to_vec();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
@ -3,7 +3,12 @@
|
|||
// We also check the out_of_bounds_indexing lint here, because it lints similar things and
|
||||
// we want to avoid false positives.
|
||||
#![warn(clippy::out_of_bounds_indexing)]
|
||||
#![allow(unconditional_panic, clippy::no_effect, clippy::unnecessary_operation)]
|
||||
#![allow(
|
||||
unconditional_panic,
|
||||
clippy::no_effect,
|
||||
clippy::unnecessary_operation,
|
||||
clippy::useless_vec
|
||||
)]
|
||||
|
||||
const ARR: [i32; 2] = [1, 2];
|
||||
const REF: &i32 = &ARR[idx()]; // This should be linted, since `suppress-restriction-lint-in-const` default is false.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: indexing may panic
|
||||
--> $DIR/indexing_slicing_index.rs:9:20
|
||||
--> $DIR/indexing_slicing_index.rs:14:20
|
||||
|
|
||||
LL | const REF: &i32 = &ARR[idx()]; // This should be linted, since `suppress-restriction-lint-in-const` default is false.
|
||||
| ^^^^^^^^^^
|
||||
|
@ -9,7 +9,7 @@ LL | const REF: &i32 = &ARR[idx()]; // This should be linted, since `suppress-re
|
|||
= note: `-D clippy::indexing-slicing` implied by `-D warnings`
|
||||
|
||||
error: indexing may panic
|
||||
--> $DIR/indexing_slicing_index.rs:10:24
|
||||
--> $DIR/indexing_slicing_index.rs:15:24
|
||||
|
|
||||
LL | const REF_ERR: &i32 = &ARR[idx4()]; // Ok, let rustc handle const contexts.
|
||||
| ^^^^^^^^^^^
|
||||
|
@ -18,19 +18,19 @@ LL | const REF_ERR: &i32 = &ARR[idx4()]; // Ok, let rustc handle const contexts.
|
|||
= note: the suggestion might not be applicable in constant blocks
|
||||
|
||||
error[E0080]: evaluation of `main::{constant#3}` failed
|
||||
--> $DIR/indexing_slicing_index.rs:31:14
|
||||
--> $DIR/indexing_slicing_index.rs:36:14
|
||||
|
|
||||
LL | const { &ARR[idx4()] }; // This should be linted, since `suppress-restriction-lint-in-const` default is false.
|
||||
| ^^^^^^^^^^^ index out of bounds: the length is 2 but the index is 4
|
||||
|
||||
note: erroneous constant used
|
||||
--> $DIR/indexing_slicing_index.rs:31:5
|
||||
--> $DIR/indexing_slicing_index.rs:36:5
|
||||
|
|
||||
LL | const { &ARR[idx4()] }; // This should be linted, since `suppress-restriction-lint-in-const` default is false.
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: indexing may panic
|
||||
--> $DIR/indexing_slicing_index.rs:22:5
|
||||
--> $DIR/indexing_slicing_index.rs:27:5
|
||||
|
|
||||
LL | x[index];
|
||||
| ^^^^^^^^
|
||||
|
@ -38,7 +38,7 @@ LL | x[index];
|
|||
= help: consider using `.get(n)` or `.get_mut(n)` instead
|
||||
|
||||
error: indexing may panic
|
||||
--> $DIR/indexing_slicing_index.rs:30:14
|
||||
--> $DIR/indexing_slicing_index.rs:35:14
|
||||
|
|
||||
LL | const { &ARR[idx()] }; // This should be linted, since `suppress-restriction-lint-in-const` default is false.
|
||||
| ^^^^^^^^^^
|
||||
|
@ -47,7 +47,7 @@ LL | const { &ARR[idx()] }; // This should be linted, since `suppress-restri
|
|||
= note: the suggestion might not be applicable in constant blocks
|
||||
|
||||
error: indexing may panic
|
||||
--> $DIR/indexing_slicing_index.rs:31:14
|
||||
--> $DIR/indexing_slicing_index.rs:36:14
|
||||
|
|
||||
LL | const { &ARR[idx4()] }; // This should be linted, since `suppress-restriction-lint-in-const` default is false.
|
||||
| ^^^^^^^^^^^
|
||||
|
@ -56,7 +56,7 @@ LL | const { &ARR[idx4()] }; // This should be linted, since `suppress-restr
|
|||
= note: the suggestion might not be applicable in constant blocks
|
||||
|
||||
error: indexing may panic
|
||||
--> $DIR/indexing_slicing_index.rs:38:5
|
||||
--> $DIR/indexing_slicing_index.rs:43:5
|
||||
|
|
||||
LL | v[0];
|
||||
| ^^^^
|
||||
|
@ -64,7 +64,7 @@ LL | v[0];
|
|||
= help: consider using `.get(n)` or `.get_mut(n)` instead
|
||||
|
||||
error: indexing may panic
|
||||
--> $DIR/indexing_slicing_index.rs:39:5
|
||||
--> $DIR/indexing_slicing_index.rs:44:5
|
||||
|
|
||||
LL | v[10];
|
||||
| ^^^^^
|
||||
|
@ -72,7 +72,7 @@ LL | v[10];
|
|||
= help: consider using `.get(n)` or `.get_mut(n)` instead
|
||||
|
||||
error: indexing may panic
|
||||
--> $DIR/indexing_slicing_index.rs:40:5
|
||||
--> $DIR/indexing_slicing_index.rs:45:5
|
||||
|
|
||||
LL | v[1 << 3];
|
||||
| ^^^^^^^^^
|
||||
|
@ -80,7 +80,7 @@ LL | v[1 << 3];
|
|||
= help: consider using `.get(n)` or `.get_mut(n)` instead
|
||||
|
||||
error: indexing may panic
|
||||
--> $DIR/indexing_slicing_index.rs:46:5
|
||||
--> $DIR/indexing_slicing_index.rs:51:5
|
||||
|
|
||||
LL | v[N];
|
||||
| ^^^^
|
||||
|
@ -88,7 +88,7 @@ LL | v[N];
|
|||
= help: consider using `.get(n)` or `.get_mut(n)` instead
|
||||
|
||||
error: indexing may panic
|
||||
--> $DIR/indexing_slicing_index.rs:47:5
|
||||
--> $DIR/indexing_slicing_index.rs:52:5
|
||||
|
|
||||
LL | v[M];
|
||||
| ^^^^
|
||||
|
@ -96,7 +96,7 @@ LL | v[M];
|
|||
= help: consider using `.get(n)` or `.get_mut(n)` instead
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/indexing_slicing_index.rs:10:24
|
||||
--> $DIR/indexing_slicing_index.rs:15:24
|
||||
|
|
||||
LL | const REF_ERR: &i32 = &ARR[idx4()]; // Ok, let rustc handle const contexts.
|
||||
| ^^^^^^^^^^^ index out of bounds: the length is 2 but the index is 4
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// We also check the out_of_bounds_indexing lint here, because it lints similar things and
|
||||
// we want to avoid false positives.
|
||||
#![warn(clippy::out_of_bounds_indexing)]
|
||||
#![allow(clippy::no_effect, clippy::unnecessary_operation)]
|
||||
#![allow(clippy::no_effect, clippy::unnecessary_operation, clippy::useless_vec)]
|
||||
|
||||
fn main() {
|
||||
let x = [1, 2, 3, 4];
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
array_into_iter,
|
||||
unused_mut,
|
||||
clippy::into_iter_on_ref,
|
||||
clippy::unnecessary_operation
|
||||
clippy::unnecessary_operation,
|
||||
clippy::useless_vec
|
||||
)]
|
||||
|
||||
extern crate option_helpers;
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
array_into_iter,
|
||||
unused_mut,
|
||||
clippy::into_iter_on_ref,
|
||||
clippy::unnecessary_operation
|
||||
clippy::unnecessary_operation,
|
||||
clippy::useless_vec
|
||||
)]
|
||||
|
||||
extern crate option_helpers;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: called `.iter().count()` on a `slice`
|
||||
--> $DIR/iter_count.rs:54:6
|
||||
--> $DIR/iter_count.rs:55:6
|
||||
|
|
||||
LL | &vec[..].iter().count();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec[..].len()`
|
||||
|
@ -7,145 +7,145 @@ LL | &vec[..].iter().count();
|
|||
= note: `-D clippy::iter-count` implied by `-D warnings`
|
||||
|
||||
error: called `.iter().count()` on a `Vec`
|
||||
--> $DIR/iter_count.rs:55:5
|
||||
--> $DIR/iter_count.rs:56:5
|
||||
|
|
||||
LL | vec.iter().count();
|
||||
| ^^^^^^^^^^^^^^^^^^ help: try: `vec.len()`
|
||||
|
||||
error: called `.iter().count()` on a `slice`
|
||||
--> $DIR/iter_count.rs:56:5
|
||||
--> $DIR/iter_count.rs:57:5
|
||||
|
|
||||
LL | boxed_slice.iter().count();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `boxed_slice.len()`
|
||||
|
||||
error: called `.iter().count()` on a `VecDeque`
|
||||
--> $DIR/iter_count.rs:57:5
|
||||
--> $DIR/iter_count.rs:58:5
|
||||
|
|
||||
LL | vec_deque.iter().count();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec_deque.len()`
|
||||
|
||||
error: called `.iter().count()` on a `HashSet`
|
||||
--> $DIR/iter_count.rs:58:5
|
||||
--> $DIR/iter_count.rs:59:5
|
||||
|
|
||||
LL | hash_set.iter().count();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `hash_set.len()`
|
||||
|
||||
error: called `.iter().count()` on a `HashMap`
|
||||
--> $DIR/iter_count.rs:59:5
|
||||
--> $DIR/iter_count.rs:60:5
|
||||
|
|
||||
LL | hash_map.iter().count();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `hash_map.len()`
|
||||
|
||||
error: called `.iter().count()` on a `BTreeMap`
|
||||
--> $DIR/iter_count.rs:60:5
|
||||
--> $DIR/iter_count.rs:61:5
|
||||
|
|
||||
LL | b_tree_map.iter().count();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `b_tree_map.len()`
|
||||
|
||||
error: called `.iter().count()` on a `BTreeSet`
|
||||
--> $DIR/iter_count.rs:61:5
|
||||
--> $DIR/iter_count.rs:62:5
|
||||
|
|
||||
LL | b_tree_set.iter().count();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `b_tree_set.len()`
|
||||
|
||||
error: called `.iter().count()` on a `LinkedList`
|
||||
--> $DIR/iter_count.rs:62:5
|
||||
--> $DIR/iter_count.rs:63:5
|
||||
|
|
||||
LL | linked_list.iter().count();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `linked_list.len()`
|
||||
|
||||
error: called `.iter().count()` on a `BinaryHeap`
|
||||
--> $DIR/iter_count.rs:63:5
|
||||
--> $DIR/iter_count.rs:64:5
|
||||
|
|
||||
LL | binary_heap.iter().count();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `binary_heap.len()`
|
||||
|
||||
error: called `.iter_mut().count()` on a `Vec`
|
||||
--> $DIR/iter_count.rs:65:5
|
||||
--> $DIR/iter_count.rs:66:5
|
||||
|
|
||||
LL | vec.iter_mut().count();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.len()`
|
||||
|
||||
error: called `.iter_mut().count()` on a `slice`
|
||||
--> $DIR/iter_count.rs:66:6
|
||||
--> $DIR/iter_count.rs:67:6
|
||||
|
|
||||
LL | &vec[..].iter_mut().count();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec[..].len()`
|
||||
|
||||
error: called `.iter_mut().count()` on a `VecDeque`
|
||||
--> $DIR/iter_count.rs:67:5
|
||||
--> $DIR/iter_count.rs:68:5
|
||||
|
|
||||
LL | vec_deque.iter_mut().count();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec_deque.len()`
|
||||
|
||||
error: called `.iter_mut().count()` on a `HashMap`
|
||||
--> $DIR/iter_count.rs:68:5
|
||||
--> $DIR/iter_count.rs:69:5
|
||||
|
|
||||
LL | hash_map.iter_mut().count();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `hash_map.len()`
|
||||
|
||||
error: called `.iter_mut().count()` on a `BTreeMap`
|
||||
--> $DIR/iter_count.rs:69:5
|
||||
--> $DIR/iter_count.rs:70:5
|
||||
|
|
||||
LL | b_tree_map.iter_mut().count();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `b_tree_map.len()`
|
||||
|
||||
error: called `.iter_mut().count()` on a `LinkedList`
|
||||
--> $DIR/iter_count.rs:70:5
|
||||
--> $DIR/iter_count.rs:71:5
|
||||
|
|
||||
LL | linked_list.iter_mut().count();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `linked_list.len()`
|
||||
|
||||
error: called `.into_iter().count()` on a `slice`
|
||||
--> $DIR/iter_count.rs:72:6
|
||||
--> $DIR/iter_count.rs:73:6
|
||||
|
|
||||
LL | &vec[..].into_iter().count();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec[..].len()`
|
||||
|
||||
error: called `.into_iter().count()` on a `Vec`
|
||||
--> $DIR/iter_count.rs:73:5
|
||||
--> $DIR/iter_count.rs:74:5
|
||||
|
|
||||
LL | vec.into_iter().count();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.len()`
|
||||
|
||||
error: called `.into_iter().count()` on a `VecDeque`
|
||||
--> $DIR/iter_count.rs:74:5
|
||||
--> $DIR/iter_count.rs:75:5
|
||||
|
|
||||
LL | vec_deque.into_iter().count();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec_deque.len()`
|
||||
|
||||
error: called `.into_iter().count()` on a `HashSet`
|
||||
--> $DIR/iter_count.rs:75:5
|
||||
--> $DIR/iter_count.rs:76:5
|
||||
|
|
||||
LL | hash_set.into_iter().count();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `hash_set.len()`
|
||||
|
||||
error: called `.into_iter().count()` on a `HashMap`
|
||||
--> $DIR/iter_count.rs:76:5
|
||||
--> $DIR/iter_count.rs:77:5
|
||||
|
|
||||
LL | hash_map.into_iter().count();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `hash_map.len()`
|
||||
|
||||
error: called `.into_iter().count()` on a `BTreeMap`
|
||||
--> $DIR/iter_count.rs:77:5
|
||||
--> $DIR/iter_count.rs:78:5
|
||||
|
|
||||
LL | b_tree_map.into_iter().count();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `b_tree_map.len()`
|
||||
|
||||
error: called `.into_iter().count()` on a `BTreeSet`
|
||||
--> $DIR/iter_count.rs:78:5
|
||||
--> $DIR/iter_count.rs:79:5
|
||||
|
|
||||
LL | b_tree_set.into_iter().count();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `b_tree_set.len()`
|
||||
|
||||
error: called `.into_iter().count()` on a `LinkedList`
|
||||
--> $DIR/iter_count.rs:79:5
|
||||
--> $DIR/iter_count.rs:80:5
|
||||
|
|
||||
LL | linked_list.into_iter().count();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `linked_list.len()`
|
||||
|
||||
error: called `.into_iter().count()` on a `BinaryHeap`
|
||||
--> $DIR/iter_count.rs:80:5
|
||||
--> $DIR/iter_count.rs:81:5
|
||||
|
|
||||
LL | binary_heap.into_iter().count();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `binary_heap.len()`
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
//@run-rustfix
|
||||
#![warn(clippy::iter_next_slice)]
|
||||
#![allow(clippy::useless_vec)]
|
||||
|
||||
fn main() {
|
||||
// test code goes here
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
//@run-rustfix
|
||||
#![warn(clippy::iter_next_slice)]
|
||||
#![allow(clippy::useless_vec)]
|
||||
|
||||
fn main() {
|
||||
// test code goes here
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: using `.iter().next()` on an array
|
||||
--> $DIR/iter_next_slice.rs:9:13
|
||||
--> $DIR/iter_next_slice.rs:10:13
|
||||
|
|
||||
LL | let _ = s.iter().next();
|
||||
| ^^^^^^^^^^^^^^^ help: try calling: `s.first()`
|
||||
|
@ -7,19 +7,19 @@ LL | let _ = s.iter().next();
|
|||
= note: `-D clippy::iter-next-slice` implied by `-D warnings`
|
||||
|
||||
error: using `.iter().next()` on a Slice without end index
|
||||
--> $DIR/iter_next_slice.rs:12:13
|
||||
--> $DIR/iter_next_slice.rs:13:13
|
||||
|
|
||||
LL | let _ = s[2..].iter().next();
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: try calling: `s.get(2)`
|
||||
|
||||
error: using `.iter().next()` on a Slice without end index
|
||||
--> $DIR/iter_next_slice.rs:15:13
|
||||
--> $DIR/iter_next_slice.rs:16:13
|
||||
|
|
||||
LL | let _ = v[5..].iter().next();
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: try calling: `v.get(5)`
|
||||
|
||||
error: using `.iter().next()` on an array
|
||||
--> $DIR/iter_next_slice.rs:18:13
|
||||
--> $DIR/iter_next_slice.rs:19:13
|
||||
|
|
||||
LL | let _ = v.iter().next();
|
||||
| ^^^^^^^^^^^^^^^ help: try calling: `v.first()`
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
//@aux-build:option_helpers.rs
|
||||
|
||||
#![warn(clippy::iter_nth)]
|
||||
#![allow(clippy::useless_vec)]
|
||||
|
||||
#[macro_use]
|
||||
extern crate option_helpers;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: called `.iter().nth()` on a Vec
|
||||
--> $DIR/iter_nth.rs:33:23
|
||||
--> $DIR/iter_nth.rs:34:23
|
||||
|
|
||||
LL | let bad_vec = some_vec.iter().nth(3);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -8,7 +8,7 @@ LL | let bad_vec = some_vec.iter().nth(3);
|
|||
= note: `-D clippy::iter-nth` implied by `-D warnings`
|
||||
|
||||
error: called `.iter().nth()` on a slice
|
||||
--> $DIR/iter_nth.rs:34:26
|
||||
--> $DIR/iter_nth.rs:35:26
|
||||
|
|
||||
LL | let bad_slice = &some_vec[..].iter().nth(3);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -16,7 +16,7 @@ LL | let bad_slice = &some_vec[..].iter().nth(3);
|
|||
= help: calling `.get()` is both faster and more readable
|
||||
|
||||
error: called `.iter().nth()` on a slice
|
||||
--> $DIR/iter_nth.rs:35:31
|
||||
--> $DIR/iter_nth.rs:36:31
|
||||
|
|
||||
LL | let bad_boxed_slice = boxed_slice.iter().nth(3);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -24,7 +24,7 @@ LL | let bad_boxed_slice = boxed_slice.iter().nth(3);
|
|||
= help: calling `.get()` is both faster and more readable
|
||||
|
||||
error: called `.iter().nth()` on a VecDeque
|
||||
--> $DIR/iter_nth.rs:36:29
|
||||
--> $DIR/iter_nth.rs:37:29
|
||||
|
|
||||
LL | let bad_vec_deque = some_vec_deque.iter().nth(3);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -32,7 +32,7 @@ LL | let bad_vec_deque = some_vec_deque.iter().nth(3);
|
|||
= help: calling `.get()` is both faster and more readable
|
||||
|
||||
error: called `.iter_mut().nth()` on a Vec
|
||||
--> $DIR/iter_nth.rs:41:23
|
||||
--> $DIR/iter_nth.rs:42:23
|
||||
|
|
||||
LL | let bad_vec = some_vec.iter_mut().nth(3);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -40,7 +40,7 @@ LL | let bad_vec = some_vec.iter_mut().nth(3);
|
|||
= help: calling `.get_mut()` is both faster and more readable
|
||||
|
||||
error: called `.iter_mut().nth()` on a slice
|
||||
--> $DIR/iter_nth.rs:44:26
|
||||
--> $DIR/iter_nth.rs:45:26
|
||||
|
|
||||
LL | let bad_slice = &some_vec[..].iter_mut().nth(3);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -48,7 +48,7 @@ LL | let bad_slice = &some_vec[..].iter_mut().nth(3);
|
|||
= help: calling `.get_mut()` is both faster and more readable
|
||||
|
||||
error: called `.iter_mut().nth()` on a VecDeque
|
||||
--> $DIR/iter_nth.rs:47:29
|
||||
--> $DIR/iter_nth.rs:48:29
|
||||
|
|
||||
LL | let bad_vec_deque = some_vec_deque.iter_mut().nth(3);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//@run-rustfix
|
||||
#![warn(clippy::iter_overeager_cloned, clippy::redundant_clone, clippy::filter_next)]
|
||||
#![allow(dead_code, clippy::let_unit_value)]
|
||||
#![allow(dead_code, clippy::let_unit_value, clippy::useless_vec)]
|
||||
|
||||
fn main() {
|
||||
let vec = vec!["1".to_string(), "2".to_string(), "3".to_string()];
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//@run-rustfix
|
||||
#![warn(clippy::iter_overeager_cloned, clippy::redundant_clone, clippy::filter_next)]
|
||||
#![allow(dead_code, clippy::let_unit_value)]
|
||||
#![allow(dead_code, clippy::let_unit_value, clippy::useless_vec)]
|
||||
|
||||
fn main() {
|
||||
let vec = vec!["1".to_string(), "2".to_string(), "3".to_string()];
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#![warn(clippy::iter_skip_next)]
|
||||
#![allow(clippy::disallowed_names)]
|
||||
#![allow(clippy::iter_nth)]
|
||||
#![allow(clippy::useless_vec)]
|
||||
#![allow(unused_mut, dead_code)]
|
||||
|
||||
extern crate option_helpers;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#![warn(clippy::iter_skip_next)]
|
||||
#![allow(clippy::disallowed_names)]
|
||||
#![allow(clippy::iter_nth)]
|
||||
#![allow(clippy::useless_vec)]
|
||||
#![allow(unused_mut, dead_code)]
|
||||
|
||||
extern crate option_helpers;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: called `skip(..).next()` on an iterator
|
||||
--> $DIR/iter_skip_next.rs:16:28
|
||||
--> $DIR/iter_skip_next.rs:17:28
|
||||
|
|
||||
LL | let _ = some_vec.iter().skip(42).next();
|
||||
| ^^^^^^^^^^^^^^^^ help: use `nth` instead: `.nth(42)`
|
||||
|
@ -7,37 +7,37 @@ LL | let _ = some_vec.iter().skip(42).next();
|
|||
= note: `-D clippy::iter-skip-next` implied by `-D warnings`
|
||||
|
||||
error: called `skip(..).next()` on an iterator
|
||||
--> $DIR/iter_skip_next.rs:17:36
|
||||
--> $DIR/iter_skip_next.rs:18:36
|
||||
|
|
||||
LL | let _ = some_vec.iter().cycle().skip(42).next();
|
||||
| ^^^^^^^^^^^^^^^^ help: use `nth` instead: `.nth(42)`
|
||||
|
||||
error: called `skip(..).next()` on an iterator
|
||||
--> $DIR/iter_skip_next.rs:18:20
|
||||
--> $DIR/iter_skip_next.rs:19:20
|
||||
|
|
||||
LL | let _ = (1..10).skip(10).next();
|
||||
| ^^^^^^^^^^^^^^^^ help: use `nth` instead: `.nth(10)`
|
||||
|
||||
error: called `skip(..).next()` on an iterator
|
||||
--> $DIR/iter_skip_next.rs:19:33
|
||||
--> $DIR/iter_skip_next.rs:20:33
|
||||
|
|
||||
LL | let _ = &some_vec[..].iter().skip(3).next();
|
||||
| ^^^^^^^^^^^^^^^ help: use `nth` instead: `.nth(3)`
|
||||
|
||||
error: called `skip(..).next()` on an iterator
|
||||
--> $DIR/iter_skip_next.rs:27:26
|
||||
--> $DIR/iter_skip_next.rs:28:26
|
||||
|
|
||||
LL | let _: Vec<&str> = sp.skip(1).next().unwrap().split(' ').collect();
|
||||
| ^^^^^^^^^^^^^^^ help: use `nth` instead: `.nth(1)`
|
||||
|
||||
error: called `skip(..).next()` on an iterator
|
||||
--> $DIR/iter_skip_next.rs:29:29
|
||||
--> $DIR/iter_skip_next.rs:30:29
|
||||
|
|
||||
LL | let _: Vec<&str> = s.skip(1).next().unwrap().split(' ').collect();
|
||||
| ^^^^^^^^^^^^^^^ help: use `nth` instead: `.nth(1)`
|
||||
|
||||
error: called `skip(..).next()` on an iterator
|
||||
--> $DIR/iter_skip_next.rs:35:29
|
||||
--> $DIR/iter_skip_next.rs:36:29
|
||||
|
|
||||
LL | let _: Vec<&str> = s.skip(1).next().unwrap().split(' ').collect();
|
||||
| ^^^^^^^^^^^^^^^ help: use `nth` instead: `.nth(1)`
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#![allow(clippy::useless_vec)]
|
||||
#[warn(clippy::iterator_step_by_zero)]
|
||||
fn main() {
|
||||
let _ = vec!["A", "B", "B"].iter().step_by(0);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: `Iterator::step_by(0)` will panic at runtime
|
||||
--> $DIR/iterator_step_by_zero.rs:3:13
|
||||
--> $DIR/iterator_step_by_zero.rs:4:13
|
||||
|
|
||||
LL | let _ = vec!["A", "B", "B"].iter().step_by(0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -7,37 +7,37 @@ LL | let _ = vec!["A", "B", "B"].iter().step_by(0);
|
|||
= note: `-D clippy::iterator-step-by-zero` implied by `-D warnings`
|
||||
|
||||
error: `Iterator::step_by(0)` will panic at runtime
|
||||
--> $DIR/iterator_step_by_zero.rs:4:13
|
||||
--> $DIR/iterator_step_by_zero.rs:5:13
|
||||
|
|
||||
LL | let _ = "XXX".chars().step_by(0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: `Iterator::step_by(0)` will panic at runtime
|
||||
--> $DIR/iterator_step_by_zero.rs:5:13
|
||||
--> $DIR/iterator_step_by_zero.rs:6:13
|
||||
|
|
||||
LL | let _ = (0..1).step_by(0);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: `Iterator::step_by(0)` will panic at runtime
|
||||
--> $DIR/iterator_step_by_zero.rs:14:13
|
||||
--> $DIR/iterator_step_by_zero.rs:15:13
|
||||
|
|
||||
LL | let _ = (1..).step_by(0);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: `Iterator::step_by(0)` will panic at runtime
|
||||
--> $DIR/iterator_step_by_zero.rs:15:13
|
||||
--> $DIR/iterator_step_by_zero.rs:16:13
|
||||
|
|
||||
LL | let _ = (1..=2).step_by(0);
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: `Iterator::step_by(0)` will panic at runtime
|
||||
--> $DIR/iterator_step_by_zero.rs:18:13
|
||||
--> $DIR/iterator_step_by_zero.rs:19:13
|
||||
|
|
||||
LL | let _ = x.step_by(0);
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: `Iterator::step_by(0)` will panic at runtime
|
||||
--> $DIR/iterator_step_by_zero.rs:22:13
|
||||
--> $DIR/iterator_step_by_zero.rs:23:13
|
||||
|
|
||||
LL | let _ = v1.iter().step_by(2 / 3);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#![warn(clippy::manual_assert)]
|
||||
#![allow(dead_code, unused_doc_comments)]
|
||||
#![allow(clippy::nonminimal_bool, clippy::uninlined_format_args)]
|
||||
#![allow(clippy::nonminimal_bool, clippy::uninlined_format_args, clippy::useless_vec)]
|
||||
|
||||
macro_rules! one {
|
||||
() => {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#![warn(clippy::manual_assert)]
|
||||
#![allow(dead_code, unused_doc_comments)]
|
||||
#![allow(clippy::nonminimal_bool, clippy::uninlined_format_args)]
|
||||
#![allow(clippy::nonminimal_bool, clippy::uninlined_format_args, clippy::useless_vec)]
|
||||
|
||||
macro_rules! one {
|
||||
() => {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#![warn(clippy::manual_assert)]
|
||||
#![allow(dead_code, unused_doc_comments)]
|
||||
#![allow(clippy::nonminimal_bool, clippy::uninlined_format_args)]
|
||||
#![allow(clippy::nonminimal_bool, clippy::uninlined_format_args, clippy::useless_vec)]
|
||||
|
||||
macro_rules! one {
|
||||
() => {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//@run-rustfix
|
||||
|
||||
#![warn(clippy::manual_filter)]
|
||||
#![allow(unused_variables, dead_code)]
|
||||
#![allow(unused_variables, dead_code, clippy::useless_vec)]
|
||||
|
||||
fn main() {
|
||||
Some(0).filter(|&x| x <= 0);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//@run-rustfix
|
||||
|
||||
#![warn(clippy::manual_filter)]
|
||||
#![allow(unused_variables, dead_code)]
|
||||
#![allow(unused_variables, dead_code, clippy::useless_vec)]
|
||||
|
||||
fn main() {
|
||||
match Some(0) {
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#![allow(dead_code)]
|
||||
#![warn(clippy::manual_filter_map)]
|
||||
#![allow(clippy::redundant_closure)] // FIXME suggestion may have redundant closure
|
||||
#![allow(clippy::useless_vec)]
|
||||
|
||||
fn main() {
|
||||
// is_some(), unwrap()
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#![allow(dead_code)]
|
||||
#![warn(clippy::manual_filter_map)]
|
||||
#![allow(clippy::redundant_closure)] // FIXME suggestion may have redundant closure
|
||||
#![allow(clippy::useless_vec)]
|
||||
|
||||
fn main() {
|
||||
// is_some(), unwrap()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: `filter(..).map(..)` can be simplified as `filter_map(..)`
|
||||
--> $DIR/manual_filter_map.rs:8:19
|
||||
--> $DIR/manual_filter_map.rs:9:19
|
||||
|
|
||||
LL | let _ = (0..).filter(|n| to_opt(*n).is_some()).map(|a| to_opt(a).unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `filter_map(|a| to_opt(a))`
|
||||
|
@ -7,19 +7,19 @@ LL | let _ = (0..).filter(|n| to_opt(*n).is_some()).map(|a| to_opt(a).unwrap
|
|||
= note: `-D clippy::manual-filter-map` implied by `-D warnings`
|
||||
|
||||
error: `filter(..).map(..)` can be simplified as `filter_map(..)`
|
||||
--> $DIR/manual_filter_map.rs:11:19
|
||||
--> $DIR/manual_filter_map.rs:12:19
|
||||
|
|
||||
LL | let _ = (0..).filter(|&n| to_opt(n).is_some()).map(|a| to_opt(a).expect("hi"));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `filter_map(|a| to_opt(a))`
|
||||
|
||||
error: `filter(..).map(..)` can be simplified as `filter_map(..)`
|
||||
--> $DIR/manual_filter_map.rs:14:19
|
||||
--> $DIR/manual_filter_map.rs:15:19
|
||||
|
|
||||
LL | let _ = (0..).filter(|&n| to_res(n).is_ok()).map(|a| to_res(a).unwrap_or(1));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `filter_map(|a| to_res(a).ok())`
|
||||
|
||||
error: `filter(..).map(..)` can be simplified as `filter_map(..)`
|
||||
--> $DIR/manual_filter_map.rs:17:10
|
||||
--> $DIR/manual_filter_map.rs:18:10
|
||||
|
|
||||
LL | .filter(|&x| to_ref(to_opt(x)).is_some())
|
||||
| __________^
|
||||
|
@ -27,7 +27,7 @@ LL | | .map(|y| to_ref(to_opt(y)).unwrap());
|
|||
| |____________________________________________^ help: try: `filter_map(|y| *to_ref(to_opt(y)))`
|
||||
|
||||
error: `filter(..).map(..)` can be simplified as `filter_map(..)`
|
||||
--> $DIR/manual_filter_map.rs:20:10
|
||||
--> $DIR/manual_filter_map.rs:21:10
|
||||
|
|
||||
LL | .filter(|x| to_ref(to_opt(*x)).is_some())
|
||||
| __________^
|
||||
|
@ -35,7 +35,7 @@ LL | | .map(|y| to_ref(to_opt(y)).unwrap());
|
|||
| |____________________________________________^ help: try: `filter_map(|y| *to_ref(to_opt(y)))`
|
||||
|
||||
error: `filter(..).map(..)` can be simplified as `filter_map(..)`
|
||||
--> $DIR/manual_filter_map.rs:24:10
|
||||
--> $DIR/manual_filter_map.rs:25:10
|
||||
|
|
||||
LL | .filter(|&x| to_ref(to_res(x)).is_ok())
|
||||
| __________^
|
||||
|
@ -43,7 +43,7 @@ LL | | .map(|y| to_ref(to_res(y)).unwrap());
|
|||
| |____________________________________________^ help: try: `filter_map(|y| to_ref(to_res(y)).ok())`
|
||||
|
||||
error: `filter(..).map(..)` can be simplified as `filter_map(..)`
|
||||
--> $DIR/manual_filter_map.rs:27:10
|
||||
--> $DIR/manual_filter_map.rs:28:10
|
||||
|
|
||||
LL | .filter(|x| to_ref(to_res(*x)).is_ok())
|
||||
| __________^
|
||||
|
@ -51,7 +51,7 @@ LL | | .map(|y| to_ref(to_res(y)).unwrap());
|
|||
| |____________________________________________^ help: try: `filter_map(|y| to_ref(to_res(y)).ok())`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_filter_map.rs:33:27
|
||||
--> $DIR/manual_filter_map.rs:34:27
|
||||
|
|
||||
LL | iter::<Option<&u8>>().find(|x| x.is_some()).map(|x| x.cloned().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.cloned())`
|
||||
|
@ -59,67 +59,67 @@ LL | iter::<Option<&u8>>().find(|x| x.is_some()).map(|x| x.cloned().unwrap()
|
|||
= note: `-D clippy::manual-find-map` implied by `-D warnings`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_filter_map.rs:34:28
|
||||
--> $DIR/manual_filter_map.rs:35:28
|
||||
|
|
||||
LL | iter::<&Option<&u8>>().find(|x| x.is_some()).map(|x| x.cloned().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.cloned())`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_filter_map.rs:35:31
|
||||
--> $DIR/manual_filter_map.rs:36:31
|
||||
|
|
||||
LL | iter::<&Option<String>>().find(|x| x.is_some()).map(|x| x.as_deref().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.as_deref())`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_filter_map.rs:36:31
|
||||
--> $DIR/manual_filter_map.rs:37:31
|
||||
|
|
||||
LL | iter::<Option<&String>>().find(|&x| to_ref(x).is_some()).map(|y| to_ref(y).cloned().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|y| to_ref(y).cloned())`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_filter_map.rs:38:30
|
||||
--> $DIR/manual_filter_map.rs:39:30
|
||||
|
|
||||
LL | iter::<Result<u8, ()>>().find(|x| x.is_ok()).map(|x| x.unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.ok())`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_filter_map.rs:39:31
|
||||
--> $DIR/manual_filter_map.rs:40:31
|
||||
|
|
||||
LL | iter::<&Result<u8, ()>>().find(|x| x.is_ok()).map(|x| x.unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.ok())`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_filter_map.rs:40:32
|
||||
--> $DIR/manual_filter_map.rs:41:32
|
||||
|
|
||||
LL | iter::<&&Result<u8, ()>>().find(|x| x.is_ok()).map(|x| x.unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.ok())`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_filter_map.rs:41:31
|
||||
--> $DIR/manual_filter_map.rs:42:31
|
||||
|
|
||||
LL | iter::<Result<&u8, ()>>().find(|x| x.is_ok()).map(|x| x.cloned().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.cloned().ok())`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_filter_map.rs:42:32
|
||||
--> $DIR/manual_filter_map.rs:43:32
|
||||
|
|
||||
LL | iter::<&Result<&u8, ()>>().find(|x| x.is_ok()).map(|x| x.cloned().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.cloned().ok())`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_filter_map.rs:43:35
|
||||
--> $DIR/manual_filter_map.rs:44:35
|
||||
|
|
||||
LL | iter::<&Result<String, ()>>().find(|x| x.is_ok()).map(|x| x.as_deref().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.as_deref().ok())`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_filter_map.rs:44:35
|
||||
--> $DIR/manual_filter_map.rs:45:35
|
||||
|
|
||||
LL | iter::<Result<&String, ()>>().find(|&x| to_ref(x).is_ok()).map(|y| to_ref(y).cloned().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|y| to_ref(y).cloned().ok())`
|
||||
|
||||
error: `filter(..).map(..)` can be simplified as `filter_map(..)`
|
||||
--> $DIR/manual_filter_map.rs:92:10
|
||||
--> $DIR/manual_filter_map.rs:93:10
|
||||
|
|
||||
LL | .filter(|f| f.option_field.is_some())
|
||||
| __________^
|
||||
|
@ -127,7 +127,7 @@ LL | | .map(|f| f.option_field.clone().unwrap());
|
|||
| |_________________________________________________^ help: try: `filter_map(|f| f.option_field.clone())`
|
||||
|
||||
error: `filter(..).map(..)` can be simplified as `filter_map(..)`
|
||||
--> $DIR/manual_filter_map.rs:97:10
|
||||
--> $DIR/manual_filter_map.rs:98:10
|
||||
|
|
||||
LL | .filter(|f| f.ref_field.is_some())
|
||||
| __________^
|
||||
|
@ -135,7 +135,7 @@ LL | | .map(|f| f.ref_field.cloned().unwrap());
|
|||
| |_______________________________________________^ help: try: `filter_map(|f| f.ref_field.cloned())`
|
||||
|
||||
error: `filter(..).map(..)` can be simplified as `filter_map(..)`
|
||||
--> $DIR/manual_filter_map.rs:102:10
|
||||
--> $DIR/manual_filter_map.rs:103:10
|
||||
|
|
||||
LL | .filter(|f| f.ref_field.is_some())
|
||||
| __________^
|
||||
|
@ -143,7 +143,7 @@ LL | | .map(|f| f.ref_field.copied().unwrap());
|
|||
| |_______________________________________________^ help: try: `filter_map(|f| f.ref_field.copied())`
|
||||
|
||||
error: `filter(..).map(..)` can be simplified as `filter_map(..)`
|
||||
--> $DIR/manual_filter_map.rs:107:10
|
||||
--> $DIR/manual_filter_map.rs:108:10
|
||||
|
|
||||
LL | .filter(|f| f.result_field.is_ok())
|
||||
| __________^
|
||||
|
@ -151,7 +151,7 @@ LL | | .map(|f| f.result_field.clone().unwrap());
|
|||
| |_________________________________________________^ help: try: `filter_map(|f| f.result_field.clone().ok())`
|
||||
|
||||
error: `filter(..).map(..)` can be simplified as `filter_map(..)`
|
||||
--> $DIR/manual_filter_map.rs:112:10
|
||||
--> $DIR/manual_filter_map.rs:113:10
|
||||
|
|
||||
LL | .filter(|f| f.result_field.is_ok())
|
||||
| __________^
|
||||
|
@ -159,7 +159,7 @@ LL | | .map(|f| f.result_field.as_ref().unwrap());
|
|||
| |__________________________________________________^ help: try: `filter_map(|f| f.result_field.as_ref().ok())`
|
||||
|
||||
error: `filter(..).map(..)` can be simplified as `filter_map(..)`
|
||||
--> $DIR/manual_filter_map.rs:117:10
|
||||
--> $DIR/manual_filter_map.rs:118:10
|
||||
|
|
||||
LL | .filter(|f| f.result_field.is_ok())
|
||||
| __________^
|
||||
|
@ -167,7 +167,7 @@ LL | | .map(|f| f.result_field.as_deref().unwrap());
|
|||
| |____________________________________________________^ help: try: `filter_map(|f| f.result_field.as_deref().ok())`
|
||||
|
||||
error: `filter(..).map(..)` can be simplified as `filter_map(..)`
|
||||
--> $DIR/manual_filter_map.rs:122:10
|
||||
--> $DIR/manual_filter_map.rs:123:10
|
||||
|
|
||||
LL | .filter(|f| f.result_field.is_ok())
|
||||
| __________^
|
||||
|
@ -175,7 +175,7 @@ LL | | .map(|f| f.result_field.as_mut().unwrap());
|
|||
| |__________________________________________________^ help: try: `filter_map(|f| f.result_field.as_mut().ok())`
|
||||
|
||||
error: `filter(..).map(..)` can be simplified as `filter_map(..)`
|
||||
--> $DIR/manual_filter_map.rs:127:10
|
||||
--> $DIR/manual_filter_map.rs:128:10
|
||||
|
|
||||
LL | .filter(|f| f.result_field.is_ok())
|
||||
| __________^
|
||||
|
@ -183,7 +183,7 @@ LL | | .map(|f| f.result_field.as_deref_mut().unwrap());
|
|||
| |________________________________________________________^ help: try: `filter_map(|f| f.result_field.as_deref_mut().ok())`
|
||||
|
||||
error: `filter(..).map(..)` can be simplified as `filter_map(..)`
|
||||
--> $DIR/manual_filter_map.rs:132:10
|
||||
--> $DIR/manual_filter_map.rs:133:10
|
||||
|
|
||||
LL | .filter(|f| f.result_field.is_ok())
|
||||
| __________^
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#![allow(dead_code)]
|
||||
#![warn(clippy::manual_find_map)]
|
||||
#![allow(clippy::redundant_closure)] // FIXME suggestion may have redundant closure
|
||||
#![allow(clippy::useless_vec)]
|
||||
|
||||
fn main() {
|
||||
// is_some(), unwrap()
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#![allow(dead_code)]
|
||||
#![warn(clippy::manual_find_map)]
|
||||
#![allow(clippy::redundant_closure)] // FIXME suggestion may have redundant closure
|
||||
#![allow(clippy::useless_vec)]
|
||||
|
||||
fn main() {
|
||||
// is_some(), unwrap()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_find_map.rs:8:19
|
||||
--> $DIR/manual_find_map.rs:9:19
|
||||
|
|
||||
LL | let _ = (0..).find(|n| to_opt(*n).is_some()).map(|a| to_opt(a).unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|a| to_opt(a))`
|
||||
|
@ -7,19 +7,19 @@ LL | let _ = (0..).find(|n| to_opt(*n).is_some()).map(|a| to_opt(a).unwrap()
|
|||
= note: `-D clippy::manual-find-map` implied by `-D warnings`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_find_map.rs:11:19
|
||||
--> $DIR/manual_find_map.rs:12:19
|
||||
|
|
||||
LL | let _ = (0..).find(|&n| to_opt(n).is_some()).map(|a| to_opt(a).expect("hi"));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|a| to_opt(a))`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_find_map.rs:14:19
|
||||
--> $DIR/manual_find_map.rs:15:19
|
||||
|
|
||||
LL | let _ = (0..).find(|&n| to_res(n).is_ok()).map(|a| to_res(a).unwrap_or(1));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|a| to_res(a).ok())`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_find_map.rs:17:10
|
||||
--> $DIR/manual_find_map.rs:18:10
|
||||
|
|
||||
LL | .find(|&x| to_ref(to_opt(x)).is_some())
|
||||
| __________^
|
||||
|
@ -27,7 +27,7 @@ LL | | .map(|y| to_ref(to_opt(y)).unwrap());
|
|||
| |____________________________________________^ help: try: `find_map(|y| *to_ref(to_opt(y)))`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_find_map.rs:20:10
|
||||
--> $DIR/manual_find_map.rs:21:10
|
||||
|
|
||||
LL | .find(|x| to_ref(to_opt(*x)).is_some())
|
||||
| __________^
|
||||
|
@ -35,7 +35,7 @@ LL | | .map(|y| to_ref(to_opt(y)).unwrap());
|
|||
| |____________________________________________^ help: try: `find_map(|y| *to_ref(to_opt(y)))`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_find_map.rs:24:10
|
||||
--> $DIR/manual_find_map.rs:25:10
|
||||
|
|
||||
LL | .find(|&x| to_ref(to_res(x)).is_ok())
|
||||
| __________^
|
||||
|
@ -43,7 +43,7 @@ LL | | .map(|y| to_ref(to_res(y)).unwrap());
|
|||
| |____________________________________________^ help: try: `find_map(|y| to_ref(to_res(y)).ok())`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_find_map.rs:27:10
|
||||
--> $DIR/manual_find_map.rs:28:10
|
||||
|
|
||||
LL | .find(|x| to_ref(to_res(*x)).is_ok())
|
||||
| __________^
|
||||
|
@ -51,91 +51,91 @@ LL | | .map(|y| to_ref(to_res(y)).unwrap());
|
|||
| |____________________________________________^ help: try: `find_map(|y| to_ref(to_res(y)).ok())`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_find_map.rs:33:26
|
||||
--> $DIR/manual_find_map.rs:34:26
|
||||
|
|
||||
LL | iter::<Option<u8>>().find(|x| x.is_some()).map(|x| x.unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x)`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_find_map.rs:34:27
|
||||
--> $DIR/manual_find_map.rs:35:27
|
||||
|
|
||||
LL | iter::<&Option<u8>>().find(|x| x.is_some()).map(|x| x.unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| *x)`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_find_map.rs:35:28
|
||||
--> $DIR/manual_find_map.rs:36:28
|
||||
|
|
||||
LL | iter::<&&Option<u8>>().find(|x| x.is_some()).map(|x| x.unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| **x)`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_find_map.rs:36:27
|
||||
--> $DIR/manual_find_map.rs:37:27
|
||||
|
|
||||
LL | iter::<Option<&u8>>().find(|x| x.is_some()).map(|x| x.cloned().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.cloned())`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_find_map.rs:37:28
|
||||
--> $DIR/manual_find_map.rs:38:28
|
||||
|
|
||||
LL | iter::<&Option<&u8>>().find(|x| x.is_some()).map(|x| x.cloned().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.cloned())`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_find_map.rs:38:31
|
||||
--> $DIR/manual_find_map.rs:39:31
|
||||
|
|
||||
LL | iter::<&Option<String>>().find(|x| x.is_some()).map(|x| x.as_deref().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.as_deref())`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_find_map.rs:39:31
|
||||
--> $DIR/manual_find_map.rs:40:31
|
||||
|
|
||||
LL | iter::<Option<&String>>().find(|&x| to_ref(x).is_some()).map(|y| to_ref(y).cloned().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|y| to_ref(y).cloned())`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_find_map.rs:41:30
|
||||
--> $DIR/manual_find_map.rs:42:30
|
||||
|
|
||||
LL | iter::<Result<u8, ()>>().find(|x| x.is_ok()).map(|x| x.unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.ok())`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_find_map.rs:42:31
|
||||
--> $DIR/manual_find_map.rs:43:31
|
||||
|
|
||||
LL | iter::<&Result<u8, ()>>().find(|x| x.is_ok()).map(|x| x.unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.ok())`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_find_map.rs:43:32
|
||||
--> $DIR/manual_find_map.rs:44:32
|
||||
|
|
||||
LL | iter::<&&Result<u8, ()>>().find(|x| x.is_ok()).map(|x| x.unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.ok())`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_find_map.rs:44:31
|
||||
--> $DIR/manual_find_map.rs:45:31
|
||||
|
|
||||
LL | iter::<Result<&u8, ()>>().find(|x| x.is_ok()).map(|x| x.cloned().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.cloned().ok())`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_find_map.rs:45:32
|
||||
--> $DIR/manual_find_map.rs:46:32
|
||||
|
|
||||
LL | iter::<&Result<&u8, ()>>().find(|x| x.is_ok()).map(|x| x.cloned().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.cloned().ok())`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_find_map.rs:46:35
|
||||
--> $DIR/manual_find_map.rs:47:35
|
||||
|
|
||||
LL | iter::<&Result<String, ()>>().find(|x| x.is_ok()).map(|x| x.as_deref().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.as_deref().ok())`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_find_map.rs:47:35
|
||||
--> $DIR/manual_find_map.rs:48:35
|
||||
|
|
||||
LL | iter::<Result<&String, ()>>().find(|&x| to_ref(x).is_ok()).map(|y| to_ref(y).cloned().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|y| to_ref(y).cloned().ok())`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_find_map.rs:95:10
|
||||
--> $DIR/manual_find_map.rs:96:10
|
||||
|
|
||||
LL | .find(|f| f.option_field.is_some())
|
||||
| __________^
|
||||
|
@ -143,7 +143,7 @@ LL | | .map(|f| f.option_field.clone().unwrap());
|
|||
| |_________________________________________________^ help: try: `find_map(|f| f.option_field.clone())`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_find_map.rs:100:10
|
||||
--> $DIR/manual_find_map.rs:101:10
|
||||
|
|
||||
LL | .find(|f| f.ref_field.is_some())
|
||||
| __________^
|
||||
|
@ -151,7 +151,7 @@ LL | | .map(|f| f.ref_field.cloned().unwrap());
|
|||
| |_______________________________________________^ help: try: `find_map(|f| f.ref_field.cloned())`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_find_map.rs:105:10
|
||||
--> $DIR/manual_find_map.rs:106:10
|
||||
|
|
||||
LL | .find(|f| f.ref_field.is_some())
|
||||
| __________^
|
||||
|
@ -159,7 +159,7 @@ LL | | .map(|f| f.ref_field.copied().unwrap());
|
|||
| |_______________________________________________^ help: try: `find_map(|f| f.ref_field.copied())`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_find_map.rs:110:10
|
||||
--> $DIR/manual_find_map.rs:111:10
|
||||
|
|
||||
LL | .find(|f| f.result_field.is_ok())
|
||||
| __________^
|
||||
|
@ -167,7 +167,7 @@ LL | | .map(|f| f.result_field.clone().unwrap());
|
|||
| |_________________________________________________^ help: try: `find_map(|f| f.result_field.clone().ok())`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_find_map.rs:115:10
|
||||
--> $DIR/manual_find_map.rs:116:10
|
||||
|
|
||||
LL | .find(|f| f.result_field.is_ok())
|
||||
| __________^
|
||||
|
@ -175,7 +175,7 @@ LL | | .map(|f| f.result_field.as_ref().unwrap());
|
|||
| |__________________________________________________^ help: try: `find_map(|f| f.result_field.as_ref().ok())`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_find_map.rs:120:10
|
||||
--> $DIR/manual_find_map.rs:121:10
|
||||
|
|
||||
LL | .find(|f| f.result_field.is_ok())
|
||||
| __________^
|
||||
|
@ -183,7 +183,7 @@ LL | | .map(|f| f.result_field.as_deref().unwrap());
|
|||
| |____________________________________________________^ help: try: `find_map(|f| f.result_field.as_deref().ok())`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_find_map.rs:125:10
|
||||
--> $DIR/manual_find_map.rs:126:10
|
||||
|
|
||||
LL | .find(|f| f.result_field.is_ok())
|
||||
| __________^
|
||||
|
@ -191,7 +191,7 @@ LL | | .map(|f| f.result_field.as_mut().unwrap());
|
|||
| |__________________________________________________^ help: try: `find_map(|f| f.result_field.as_mut().ok())`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_find_map.rs:130:10
|
||||
--> $DIR/manual_find_map.rs:131:10
|
||||
|
|
||||
LL | .find(|f| f.result_field.is_ok())
|
||||
| __________^
|
||||
|
@ -199,7 +199,7 @@ LL | | .map(|f| f.result_field.as_deref_mut().unwrap());
|
|||
| |________________________________________________________^ help: try: `find_map(|f| f.result_field.as_deref_mut().ok())`
|
||||
|
||||
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
||||
--> $DIR/manual_find_map.rs:135:10
|
||||
--> $DIR/manual_find_map.rs:136:10
|
||||
|
|
||||
LL | .find(|f| f.result_field.is_ok())
|
||||
| __________^
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#![warn(clippy::needless_range_loop, clippy::manual_memcpy)]
|
||||
#![allow(clippy::useless_vec)]
|
||||
|
||||
const LOOP_OFFSET: usize = 5000;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: it looks like you're manually copying between slices
|
||||
--> $DIR/without_loop_counters.rs:7:5
|
||||
--> $DIR/without_loop_counters.rs:8:5
|
||||
|
|
||||
LL | / for i in 0..src.len() {
|
||||
LL | | dst[i] = src[i];
|
||||
|
@ -9,7 +9,7 @@ LL | | }
|
|||
= note: `-D clippy::manual-memcpy` implied by `-D warnings`
|
||||
|
||||
error: it looks like you're manually copying between slices
|
||||
--> $DIR/without_loop_counters.rs:12:5
|
||||
--> $DIR/without_loop_counters.rs:13:5
|
||||
|
|
||||
LL | / for i in 0..src.len() {
|
||||
LL | | dst[i + 10] = src[i];
|
||||
|
@ -17,7 +17,7 @@ LL | | }
|
|||
| |_____^ help: try replacing the loop by: `dst[10..(src.len() + 10)].copy_from_slice(&src[..]);`
|
||||
|
||||
error: it looks like you're manually copying between slices
|
||||
--> $DIR/without_loop_counters.rs:17:5
|
||||
--> $DIR/without_loop_counters.rs:18:5
|
||||
|
|
||||
LL | / for i in 0..src.len() {
|
||||
LL | | dst[i] = src[i + 10];
|
||||
|
@ -25,7 +25,7 @@ LL | | }
|
|||
| |_____^ help: try replacing the loop by: `dst[..src.len()].copy_from_slice(&src[10..(src.len() + 10)]);`
|
||||
|
||||
error: it looks like you're manually copying between slices
|
||||
--> $DIR/without_loop_counters.rs:22:5
|
||||
--> $DIR/without_loop_counters.rs:23:5
|
||||
|
|
||||
LL | / for i in 11..src.len() {
|
||||
LL | | dst[i] = src[i - 10];
|
||||
|
@ -33,7 +33,7 @@ LL | | }
|
|||
| |_____^ help: try replacing the loop by: `dst[11..src.len()].copy_from_slice(&src[(11 - 10)..(src.len() - 10)]);`
|
||||
|
||||
error: it looks like you're manually copying between slices
|
||||
--> $DIR/without_loop_counters.rs:27:5
|
||||
--> $DIR/without_loop_counters.rs:28:5
|
||||
|
|
||||
LL | / for i in 0..dst.len() {
|
||||
LL | | dst[i] = src[i];
|
||||
|
@ -41,7 +41,7 @@ LL | | }
|
|||
| |_____^ help: try replacing the loop by: `dst.copy_from_slice(&src[..dst.len()]);`
|
||||
|
||||
error: it looks like you're manually copying between slices
|
||||
--> $DIR/without_loop_counters.rs:40:5
|
||||
--> $DIR/without_loop_counters.rs:41:5
|
||||
|
|
||||
LL | / for i in 10..256 {
|
||||
LL | | dst[i] = src[i - 5];
|
||||
|
@ -56,7 +56,7 @@ LL + dst2[(10 + 500)..(256 + 500)].copy_from_slice(&src[10..256]);
|
|||
|
|
||||
|
||||
error: it looks like you're manually copying between slices
|
||||
--> $DIR/without_loop_counters.rs:52:5
|
||||
--> $DIR/without_loop_counters.rs:53:5
|
||||
|
|
||||
LL | / for i in 10..LOOP_OFFSET {
|
||||
LL | | dst[i + LOOP_OFFSET] = src[i - some_var];
|
||||
|
@ -64,7 +64,7 @@ LL | | }
|
|||
| |_____^ help: try replacing the loop by: `dst[(10 + LOOP_OFFSET)..(LOOP_OFFSET + LOOP_OFFSET)].copy_from_slice(&src[(10 - some_var)..(LOOP_OFFSET - some_var)]);`
|
||||
|
||||
error: it looks like you're manually copying between slices
|
||||
--> $DIR/without_loop_counters.rs:65:5
|
||||
--> $DIR/without_loop_counters.rs:66:5
|
||||
|
|
||||
LL | / for i in 0..src_vec.len() {
|
||||
LL | | dst_vec[i] = src_vec[i];
|
||||
|
@ -72,7 +72,7 @@ LL | | }
|
|||
| |_____^ help: try replacing the loop by: `dst_vec[..src_vec.len()].copy_from_slice(&src_vec[..]);`
|
||||
|
||||
error: it looks like you're manually copying between slices
|
||||
--> $DIR/without_loop_counters.rs:94:5
|
||||
--> $DIR/without_loop_counters.rs:95:5
|
||||
|
|
||||
LL | / for i in from..from + src.len() {
|
||||
LL | | dst[i] = src[i - from];
|
||||
|
@ -80,7 +80,7 @@ LL | | }
|
|||
| |_____^ help: try replacing the loop by: `dst[from..(from + src.len())].copy_from_slice(&src[..(from + src.len() - from)]);`
|
||||
|
||||
error: it looks like you're manually copying between slices
|
||||
--> $DIR/without_loop_counters.rs:98:5
|
||||
--> $DIR/without_loop_counters.rs:99:5
|
||||
|
|
||||
LL | / for i in from..from + 3 {
|
||||
LL | | dst[i] = src[i - from];
|
||||
|
@ -88,7 +88,7 @@ LL | | }
|
|||
| |_____^ help: try replacing the loop by: `dst[from..(from + 3)].copy_from_slice(&src[..(from + 3 - from)]);`
|
||||
|
||||
error: it looks like you're manually copying between slices
|
||||
--> $DIR/without_loop_counters.rs:103:5
|
||||
--> $DIR/without_loop_counters.rs:104:5
|
||||
|
|
||||
LL | / for i in 0..5 {
|
||||
LL | | dst[i - 0] = src[i];
|
||||
|
@ -96,7 +96,7 @@ LL | | }
|
|||
| |_____^ help: try replacing the loop by: `dst[..5].copy_from_slice(&src[..5]);`
|
||||
|
||||
error: it looks like you're manually copying between slices
|
||||
--> $DIR/without_loop_counters.rs:108:5
|
||||
--> $DIR/without_loop_counters.rs:109:5
|
||||
|
|
||||
LL | / for i in 0..0 {
|
||||
LL | | dst[i] = src[i];
|
||||
|
@ -104,7 +104,7 @@ LL | | }
|
|||
| |_____^ help: try replacing the loop by: `dst[..0].copy_from_slice(&src[..0]);`
|
||||
|
||||
error: it looks like you're manually copying between slices
|
||||
--> $DIR/without_loop_counters.rs:131:5
|
||||
--> $DIR/without_loop_counters.rs:132:5
|
||||
|
|
||||
LL | / for i in 0..src.len() {
|
||||
LL | | dst[i] = src[i].clone();
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
clippy::clone_on_copy,
|
||||
clippy::iter_cloned_collect,
|
||||
clippy::many_single_char_names,
|
||||
clippy::redundant_clone
|
||||
clippy::redundant_clone,
|
||||
clippy::useless_vec
|
||||
)]
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
clippy::clone_on_copy,
|
||||
clippy::iter_cloned_collect,
|
||||
clippy::many_single_char_names,
|
||||
clippy::redundant_clone
|
||||
clippy::redundant_clone,
|
||||
clippy::useless_vec
|
||||
)]
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: you are using an explicit closure for copying elements
|
||||
--> $DIR/map_clone.rs:11:22
|
||||
--> $DIR/map_clone.rs:12:22
|
||||
|
|
||||
LL | let _: Vec<i8> = vec![5_i8; 6].iter().map(|x| *x).collect();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `vec![5_i8; 6].iter().copied()`
|
||||
|
@ -7,31 +7,31 @@ LL | let _: Vec<i8> = vec![5_i8; 6].iter().map(|x| *x).collect();
|
|||
= note: `-D clippy::map-clone` implied by `-D warnings`
|
||||
|
||||
error: you are using an explicit closure for cloning elements
|
||||
--> $DIR/map_clone.rs:12:26
|
||||
--> $DIR/map_clone.rs:13:26
|
||||
|
|
||||
LL | let _: Vec<String> = vec![String::new()].iter().map(|x| x.clone()).collect();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `cloned` method: `vec![String::new()].iter().cloned()`
|
||||
|
||||
error: you are using an explicit closure for copying elements
|
||||
--> $DIR/map_clone.rs:13:23
|
||||
--> $DIR/map_clone.rs:14:23
|
||||
|
|
||||
LL | let _: Vec<u32> = vec![42, 43].iter().map(|&x| x).collect();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `vec![42, 43].iter().copied()`
|
||||
|
||||
error: you are using an explicit closure for copying elements
|
||||
--> $DIR/map_clone.rs:15:26
|
||||
--> $DIR/map_clone.rs:16:26
|
||||
|
|
||||
LL | let _: Option<u64> = Some(&16).map(|b| *b);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `Some(&16).copied()`
|
||||
|
||||
error: you are using an explicit closure for copying elements
|
||||
--> $DIR/map_clone.rs:16:25
|
||||
--> $DIR/map_clone.rs:17:25
|
||||
|
|
||||
LL | let _: Option<u8> = Some(&1).map(|x| x.clone());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `Some(&1).copied()`
|
||||
|
||||
error: you are needlessly cloning iterator elements
|
||||
--> $DIR/map_clone.rs:27:29
|
||||
--> $DIR/map_clone.rs:28:29
|
||||
|
|
||||
LL | let _ = std::env::args().map(|v| v.clone());
|
||||
| ^^^^^^^^^^^^^^^^^^^ help: remove the `map` call
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#![warn(clippy::match_on_vec_items)]
|
||||
#![allow(clippy::useless_vec)]
|
||||
|
||||
fn match_with_wildcard() {
|
||||
let arr = vec![0, 1, 2, 3];
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: indexing into a vector may panic
|
||||
--> $DIR/match_on_vec_items.rs:9:11
|
||||
--> $DIR/match_on_vec_items.rs:10:11
|
||||
|
|
||||
LL | match arr[idx] {
|
||||
| ^^^^^^^^ help: try this: `arr.get(idx)`
|
||||
|
@ -7,43 +7,43 @@ LL | match arr[idx] {
|
|||
= note: `-D clippy::match-on-vec-items` implied by `-D warnings`
|
||||
|
||||
error: indexing into a vector may panic
|
||||
--> $DIR/match_on_vec_items.rs:16:11
|
||||
--> $DIR/match_on_vec_items.rs:17:11
|
||||
|
|
||||
LL | match arr[range] {
|
||||
| ^^^^^^^^^^ help: try this: `arr.get(range)`
|
||||
|
||||
error: indexing into a vector may panic
|
||||
--> $DIR/match_on_vec_items.rs:29:11
|
||||
--> $DIR/match_on_vec_items.rs:30:11
|
||||
|
|
||||
LL | match arr[idx] {
|
||||
| ^^^^^^^^ help: try this: `arr.get(idx)`
|
||||
|
||||
error: indexing into a vector may panic
|
||||
--> $DIR/match_on_vec_items.rs:36:11
|
||||
--> $DIR/match_on_vec_items.rs:37:11
|
||||
|
|
||||
LL | match arr[range] {
|
||||
| ^^^^^^^^^^ help: try this: `arr.get(range)`
|
||||
|
||||
error: indexing into a vector may panic
|
||||
--> $DIR/match_on_vec_items.rs:49:11
|
||||
--> $DIR/match_on_vec_items.rs:50:11
|
||||
|
|
||||
LL | match arr[idx] {
|
||||
| ^^^^^^^^ help: try this: `arr.get(idx)`
|
||||
|
||||
error: indexing into a vector may panic
|
||||
--> $DIR/match_on_vec_items.rs:56:11
|
||||
--> $DIR/match_on_vec_items.rs:57:11
|
||||
|
|
||||
LL | match arr[range] {
|
||||
| ^^^^^^^^^^ help: try this: `arr.get(range)`
|
||||
|
||||
error: indexing into a vector may panic
|
||||
--> $DIR/match_on_vec_items.rs:69:11
|
||||
--> $DIR/match_on_vec_items.rs:70:11
|
||||
|
|
||||
LL | match arr[idx] {
|
||||
| ^^^^^^^^ help: try this: `arr.get(idx)`
|
||||
|
||||
error: indexing into a vector may panic
|
||||
--> $DIR/match_on_vec_items.rs:76:11
|
||||
--> $DIR/match_on_vec_items.rs:77:11
|
||||
|
|
||||
LL | match arr[range] {
|
||||
| ^^^^^^^^^^ help: try this: `arr.get(range)`
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
clippy::let_unit_value,
|
||||
clippy::no_effect,
|
||||
clippy::toplevel_ref_arg,
|
||||
clippy::uninlined_format_args
|
||||
clippy::uninlined_format_args,
|
||||
clippy::useless_vec
|
||||
)]
|
||||
|
||||
struct Point {
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
clippy::let_unit_value,
|
||||
clippy::no_effect,
|
||||
clippy::toplevel_ref_arg,
|
||||
clippy::uninlined_format_args
|
||||
clippy::uninlined_format_args,
|
||||
clippy::useless_vec
|
||||
)]
|
||||
|
||||
struct Point {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: this match could be written as a `let` statement
|
||||
--> $DIR/match_single_binding.rs:33:5
|
||||
--> $DIR/match_single_binding.rs:34:5
|
||||
|
|
||||
LL | / match (a, b, c) {
|
||||
LL | | (x, y, z) => {
|
||||
|
@ -18,7 +18,7 @@ LL + }
|
|||
|
|
||||
|
||||
error: this match could be written as a `let` statement
|
||||
--> $DIR/match_single_binding.rs:39:5
|
||||
--> $DIR/match_single_binding.rs:40:5
|
||||
|
|
||||
LL | / match (a, b, c) {
|
||||
LL | | (x, y, z) => println!("{} {} {}", x, y, z),
|
||||
|
@ -32,7 +32,7 @@ LL + println!("{} {} {}", x, y, z);
|
|||
|
|
||||
|
||||
error: this match could be replaced by its body itself
|
||||
--> $DIR/match_single_binding.rs:56:5
|
||||
--> $DIR/match_single_binding.rs:57:5
|
||||
|
|
||||
LL | / match a {
|
||||
LL | | _ => println!("whatever"),
|
||||
|
@ -40,7 +40,7 @@ LL | | }
|
|||
| |_____^ help: consider using the match body instead: `println!("whatever");`
|
||||
|
||||
error: this match could be replaced by its body itself
|
||||
--> $DIR/match_single_binding.rs:60:5
|
||||
--> $DIR/match_single_binding.rs:61:5
|
||||
|
|
||||
LL | / match a {
|
||||
LL | | _ => {
|
||||
|
@ -59,7 +59,7 @@ LL + }
|
|||
|
|
||||
|
||||
error: this match could be replaced by its body itself
|
||||
--> $DIR/match_single_binding.rs:67:5
|
||||
--> $DIR/match_single_binding.rs:68:5
|
||||
|
|
||||
LL | / match a {
|
||||
LL | | _ => {
|
||||
|
@ -81,7 +81,7 @@ LL + }
|
|||
|
|
||||
|
||||
error: this match could be written as a `let` statement
|
||||
--> $DIR/match_single_binding.rs:77:5
|
||||
--> $DIR/match_single_binding.rs:78:5
|
||||
|
|
||||
LL | / match p {
|
||||
LL | | Point { x, y } => println!("Coords: ({}, {})", x, y),
|
||||
|
@ -95,7 +95,7 @@ LL + println!("Coords: ({}, {})", x, y);
|
|||
|
|
||||
|
||||
error: this match could be written as a `let` statement
|
||||
--> $DIR/match_single_binding.rs:81:5
|
||||
--> $DIR/match_single_binding.rs:82:5
|
||||
|
|
||||
LL | / match p {
|
||||
LL | | Point { x: x1, y: y1 } => println!("Coords: ({}, {})", x1, y1),
|
||||
|
@ -109,7 +109,7 @@ LL + println!("Coords: ({}, {})", x1, y1);
|
|||
|
|
||||
|
||||
error: this match could be written as a `let` statement
|
||||
--> $DIR/match_single_binding.rs:86:5
|
||||
--> $DIR/match_single_binding.rs:87:5
|
||||
|
|
||||
LL | / match x {
|
||||
LL | | ref r => println!("Got a reference to {}", r),
|
||||
|
@ -123,7 +123,7 @@ LL + println!("Got a reference to {}", r);
|
|||
|
|
||||
|
||||
error: this match could be written as a `let` statement
|
||||
--> $DIR/match_single_binding.rs:91:5
|
||||
--> $DIR/match_single_binding.rs:92:5
|
||||
|
|
||||
LL | / match x {
|
||||
LL | | ref mut mr => println!("Got a mutable reference to {}", mr),
|
||||
|
@ -137,7 +137,7 @@ LL + println!("Got a mutable reference to {}", mr);
|
|||
|
|
||||
|
||||
error: this match could be written as a `let` statement
|
||||
--> $DIR/match_single_binding.rs:95:5
|
||||
--> $DIR/match_single_binding.rs:96:5
|
||||
|
|
||||
LL | / let product = match coords() {
|
||||
LL | | Point { x, y } => x * y,
|
||||
|
@ -151,7 +151,7 @@ LL + let product = x * y;
|
|||
|
|
||||
|
||||
error: this match could be written as a `let` statement
|
||||
--> $DIR/match_single_binding.rs:103:18
|
||||
--> $DIR/match_single_binding.rs:104:18
|
||||
|
|
||||
LL | .map(|i| match i.unwrap() {
|
||||
| __________________^
|
||||
|
@ -168,7 +168,7 @@ LL ~ })
|
|||
|
|
||||
|
||||
error: this match could be replaced by its body itself
|
||||
--> $DIR/match_single_binding.rs:129:5
|
||||
--> $DIR/match_single_binding.rs:130:5
|
||||
|
|
||||
LL | / match x {
|
||||
LL | | // =>
|
||||
|
@ -177,7 +177,7 @@ LL | | }
|
|||
| |_____^ help: consider using the match body instead: `println!("Not an array index start")`
|
||||
|
||||
error: this assignment could be simplified
|
||||
--> $DIR/match_single_binding.rs:138:5
|
||||
--> $DIR/match_single_binding.rs:139:5
|
||||
|
|
||||
LL | / val = match val.split_at(idx) {
|
||||
LL | | (pre, suf) => {
|
||||
|
@ -197,7 +197,7 @@ LL ~ };
|
|||
|
|
||||
|
||||
error: this match could be replaced by its scrutinee and body
|
||||
--> $DIR/match_single_binding.rs:151:16
|
||||
--> $DIR/match_single_binding.rs:152:16
|
||||
|
|
||||
LL | let _ = || match side_effects() {
|
||||
| ________________^
|
||||
|
@ -214,7 +214,7 @@ LL ~ };
|
|||
|
|
||||
|
||||
error: this match could be written as a `let` statement
|
||||
--> $DIR/match_single_binding.rs:157:5
|
||||
--> $DIR/match_single_binding.rs:158:5
|
||||
|
|
||||
LL | / match r {
|
||||
LL | | x => match x {
|
||||
|
@ -239,7 +239,7 @@ LL ~ };
|
|||
|
|
||||
|
||||
error: this match could be replaced by its body itself
|
||||
--> $DIR/match_single_binding.rs:170:5
|
||||
--> $DIR/match_single_binding.rs:171:5
|
||||
|
|
||||
LL | / match 1 {
|
||||
LL | | _ => (),
|
||||
|
@ -247,7 +247,7 @@ LL | | }
|
|||
| |_____^ help: consider using the match body instead: `();`
|
||||
|
||||
error: this match could be replaced by its body itself
|
||||
--> $DIR/match_single_binding.rs:174:13
|
||||
--> $DIR/match_single_binding.rs:175:13
|
||||
|
|
||||
LL | let a = match 1 {
|
||||
| _____________^
|
||||
|
@ -256,7 +256,7 @@ LL | | };
|
|||
| |_____^ help: consider using the match body instead: `()`
|
||||
|
||||
error: this match could be replaced by its body itself
|
||||
--> $DIR/match_single_binding.rs:178:5
|
||||
--> $DIR/match_single_binding.rs:179:5
|
||||
|
|
||||
LL | / match 1 {
|
||||
LL | | _ => side_effects(),
|
||||
|
@ -264,7 +264,7 @@ LL | | }
|
|||
| |_____^ help: consider using the match body instead: `side_effects();`
|
||||
|
||||
error: this match could be replaced by its body itself
|
||||
--> $DIR/match_single_binding.rs:182:13
|
||||
--> $DIR/match_single_binding.rs:183:13
|
||||
|
|
||||
LL | let b = match 1 {
|
||||
| _____________^
|
||||
|
@ -273,7 +273,7 @@ LL | | };
|
|||
| |_____^ help: consider using the match body instead: `side_effects()`
|
||||
|
||||
error: this match could be replaced by its body itself
|
||||
--> $DIR/match_single_binding.rs:186:5
|
||||
--> $DIR/match_single_binding.rs:187:5
|
||||
|
|
||||
LL | / match 1 {
|
||||
LL | | _ => println!("1"),
|
||||
|
@ -281,7 +281,7 @@ LL | | }
|
|||
| |_____^ help: consider using the match body instead: `println!("1");`
|
||||
|
||||
error: this match could be replaced by its body itself
|
||||
--> $DIR/match_single_binding.rs:190:13
|
||||
--> $DIR/match_single_binding.rs:191:13
|
||||
|
|
||||
LL | let c = match 1 {
|
||||
| _____________^
|
||||
|
@ -290,7 +290,7 @@ LL | | };
|
|||
| |_____^ help: consider using the match body instead: `println!("1")`
|
||||
|
||||
error: this match could be replaced by its body itself
|
||||
--> $DIR/match_single_binding.rs:195:9
|
||||
--> $DIR/match_single_binding.rs:196:9
|
||||
|
|
||||
LL | / match 1 {
|
||||
LL | | _ => (),
|
||||
|
@ -298,7 +298,7 @@ LL | | },
|
|||
| |_________^ help: consider using the match body instead: `()`
|
||||
|
||||
error: this match could be replaced by its body itself
|
||||
--> $DIR/match_single_binding.rs:198:9
|
||||
--> $DIR/match_single_binding.rs:199:9
|
||||
|
|
||||
LL | / match 1 {
|
||||
LL | | _ => side_effects(),
|
||||
|
@ -306,7 +306,7 @@ LL | | },
|
|||
| |_________^ help: consider using the match body instead: `side_effects()`
|
||||
|
||||
error: this match could be replaced by its body itself
|
||||
--> $DIR/match_single_binding.rs:201:9
|
||||
--> $DIR/match_single_binding.rs:202:9
|
||||
|
|
||||
LL | / match 1 {
|
||||
LL | | _ => println!("1"),
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
clippy::wrong_self_convention,
|
||||
clippy::unused_async,
|
||||
clippy::unused_self,
|
||||
clippy::useless_vec,
|
||||
unused
|
||||
)]
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: methods called `new` usually return `Self`
|
||||
--> $DIR/methods.rs:105:5
|
||||
--> $DIR/methods.rs:106:5
|
||||
|
|
||||
LL | / fn new() -> i32 {
|
||||
LL | | 0
|
||||
|
@ -9,7 +9,7 @@ LL | | }
|
|||
= note: `-D clippy::new-ret-no-self` implied by `-D warnings`
|
||||
|
||||
error: called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead
|
||||
--> $DIR/methods.rs:126:13
|
||||
--> $DIR/methods.rs:127:13
|
||||
|
|
||||
LL | let _ = v.iter().filter(|&x| {
|
||||
| _____________^
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
//@run-rustfix
|
||||
|
||||
#![warn(clippy::filter_next)]
|
||||
#![allow(clippy::useless_vec)]
|
||||
|
||||
/// Checks implementation of `FILTER_NEXT` lint.
|
||||
fn main() {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
//@run-rustfix
|
||||
|
||||
#![warn(clippy::filter_next)]
|
||||
#![allow(clippy::useless_vec)]
|
||||
|
||||
/// Checks implementation of `FILTER_NEXT` lint.
|
||||
fn main() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead
|
||||
--> $DIR/methods_fixable.rs:10:13
|
||||
--> $DIR/methods_fixable.rs:11:13
|
||||
|
|
||||
LL | let _ = v.iter().filter(|&x| *x < 0).next();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `v.iter().find(|&x| *x < 0)`
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#![allow(clippy::uninlined_format_args)]
|
||||
#![allow(clippy::uninlined_format_args, clippy::useless_vec)]
|
||||
#![warn(clippy::needless_collect)]
|
||||
|
||||
use std::collections::{BinaryHeap, HashMap, HashSet, LinkedList, VecDeque};
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
clippy::let_and_return,
|
||||
clippy::let_unit_value,
|
||||
clippy::nonminimal_bool,
|
||||
clippy::uninlined_format_args
|
||||
clippy::uninlined_format_args,
|
||||
clippy::useless_vec
|
||||
)]
|
||||
|
||||
extern crate proc_macros;
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
clippy::let_and_return,
|
||||
clippy::let_unit_value,
|
||||
clippy::nonminimal_bool,
|
||||
clippy::uninlined_format_args
|
||||
clippy::uninlined_format_args,
|
||||
clippy::useless_vec
|
||||
)]
|
||||
|
||||
extern crate proc_macros;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: unneeded late initialization
|
||||
--> $DIR/needless_late_init.rs:27:5
|
||||
--> $DIR/needless_late_init.rs:28:5
|
||||
|
|
||||
LL | let a;
|
||||
| ^^^^^^ created here
|
||||
|
@ -13,7 +13,7 @@ LL | let a = "zero";
|
|||
| ~~~~~
|
||||
|
||||
error: unneeded late initialization
|
||||
--> $DIR/needless_late_init.rs:30:5
|
||||
--> $DIR/needless_late_init.rs:31:5
|
||||
|
|
||||
LL | let b;
|
||||
| ^^^^^^ created here
|
||||
|
@ -27,7 +27,7 @@ LL | let b = 1;
|
|||
| ~~~~~
|
||||
|
||||
error: unneeded late initialization
|
||||
--> $DIR/needless_late_init.rs:31:5
|
||||
--> $DIR/needless_late_init.rs:32:5
|
||||
|
|
||||
LL | let c;
|
||||
| ^^^^^^ created here
|
||||
|
@ -41,7 +41,7 @@ LL | let c = 2;
|
|||
| ~~~~~
|
||||
|
||||
error: unneeded late initialization
|
||||
--> $DIR/needless_late_init.rs:35:5
|
||||
--> $DIR/needless_late_init.rs:36:5
|
||||
|
|
||||
LL | let d: usize;
|
||||
| ^^^^^^^^^^^^^ created here
|
||||
|
@ -54,7 +54,7 @@ LL | let d: usize = 1;
|
|||
| ~~~~~~~~~~~~
|
||||
|
||||
error: unneeded late initialization
|
||||
--> $DIR/needless_late_init.rs:38:5
|
||||
--> $DIR/needless_late_init.rs:39:5
|
||||
|
|
||||
LL | let e;
|
||||
| ^^^^^^ created here
|
||||
|
@ -67,7 +67,7 @@ LL | let e = format!("{}", d);
|
|||
| ~~~~~
|
||||
|
||||
error: unneeded late initialization
|
||||
--> $DIR/needless_late_init.rs:43:5
|
||||
--> $DIR/needless_late_init.rs:44:5
|
||||
|
|
||||
LL | let a;
|
||||
| ^^^^^^
|
||||
|
@ -88,7 +88,7 @@ LL | };
|
|||
| +
|
||||
|
||||
error: unneeded late initialization
|
||||
--> $DIR/needless_late_init.rs:52:5
|
||||
--> $DIR/needless_late_init.rs:53:5
|
||||
|
|
||||
LL | let b;
|
||||
| ^^^^^^
|
||||
|
@ -109,7 +109,7 @@ LL | };
|
|||
| +
|
||||
|
||||
error: unneeded late initialization
|
||||
--> $DIR/needless_late_init.rs:59:5
|
||||
--> $DIR/needless_late_init.rs:60:5
|
||||
|
|
||||
LL | let d;
|
||||
| ^^^^^^
|
||||
|
@ -130,7 +130,7 @@ LL | };
|
|||
| +
|
||||
|
||||
error: unneeded late initialization
|
||||
--> $DIR/needless_late_init.rs:67:5
|
||||
--> $DIR/needless_late_init.rs:68:5
|
||||
|
|
||||
LL | let e;
|
||||
| ^^^^^^
|
||||
|
@ -151,7 +151,7 @@ LL | };
|
|||
| +
|
||||
|
||||
error: unneeded late initialization
|
||||
--> $DIR/needless_late_init.rs:74:5
|
||||
--> $DIR/needless_late_init.rs:75:5
|
||||
|
|
||||
LL | let f;
|
||||
| ^^^^^^
|
||||
|
@ -167,7 +167,7 @@ LL + 1 => "three",
|
|||
|
|
||||
|
||||
error: unneeded late initialization
|
||||
--> $DIR/needless_late_init.rs:80:5
|
||||
--> $DIR/needless_late_init.rs:81:5
|
||||
|
|
||||
LL | let g: usize;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
@ -187,7 +187,7 @@ LL | };
|
|||
| +
|
||||
|
||||
error: unneeded late initialization
|
||||
--> $DIR/needless_late_init.rs:88:5
|
||||
--> $DIR/needless_late_init.rs:89:5
|
||||
|
|
||||
LL | let x;
|
||||
| ^^^^^^ created here
|
||||
|
@ -201,7 +201,7 @@ LL | let x = 1;
|
|||
| ~~~~~
|
||||
|
||||
error: unneeded late initialization
|
||||
--> $DIR/needless_late_init.rs:92:5
|
||||
--> $DIR/needless_late_init.rs:93:5
|
||||
|
|
||||
LL | let x;
|
||||
| ^^^^^^ created here
|
||||
|
@ -215,7 +215,7 @@ LL | let x = SignificantDrop;
|
|||
| ~~~~~
|
||||
|
||||
error: unneeded late initialization
|
||||
--> $DIR/needless_late_init.rs:96:5
|
||||
--> $DIR/needless_late_init.rs:97:5
|
||||
|
|
||||
LL | let x;
|
||||
| ^^^^^^ created here
|
||||
|
@ -229,7 +229,7 @@ LL | let x = SignificantDrop;
|
|||
| ~~~~~
|
||||
|
||||
error: unneeded late initialization
|
||||
--> $DIR/needless_late_init.rs:115:5
|
||||
--> $DIR/needless_late_init.rs:116:5
|
||||
|
|
||||
LL | let a;
|
||||
| ^^^^^^
|
||||
|
@ -250,7 +250,7 @@ LL | };
|
|||
| +
|
||||
|
||||
error: unneeded late initialization
|
||||
--> $DIR/needless_late_init.rs:132:5
|
||||
--> $DIR/needless_late_init.rs:133:5
|
||||
|
|
||||
LL | let a;
|
||||
| ^^^^^^
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#![allow(unused)]
|
||||
#![warn(clippy::needless_option_as_deref)]
|
||||
#![allow(clippy::useless_vec)]
|
||||
|
||||
fn main() {
|
||||
// should lint
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#![allow(unused)]
|
||||
#![warn(clippy::needless_option_as_deref)]
|
||||
#![allow(clippy::useless_vec)]
|
||||
|
||||
fn main() {
|
||||
// should lint
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: derefed type is same as origin
|
||||
--> $DIR/needless_option_as_deref.rs:8:29
|
||||
--> $DIR/needless_option_as_deref.rs:9:29
|
||||
|
|
||||
LL | let _: Option<&usize> = Some(&1).as_deref();
|
||||
| ^^^^^^^^^^^^^^^^^^^ help: try this: `Some(&1)`
|
||||
|
@ -7,13 +7,13 @@ LL | let _: Option<&usize> = Some(&1).as_deref();
|
|||
= note: `-D clippy::needless-option-as-deref` implied by `-D warnings`
|
||||
|
||||
error: derefed type is same as origin
|
||||
--> $DIR/needless_option_as_deref.rs:9:33
|
||||
--> $DIR/needless_option_as_deref.rs:10:33
|
||||
|
|
||||
LL | let _: Option<&mut usize> = Some(&mut 1).as_deref_mut();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `Some(&mut 1)`
|
||||
|
||||
error: derefed type is same as origin
|
||||
--> $DIR/needless_option_as_deref.rs:13:13
|
||||
--> $DIR/needless_option_as_deref.rs:14:13
|
||||
|
|
||||
LL | let _ = x.as_deref_mut();
|
||||
| ^^^^^^^^^^^^^^^^ help: try this: `x`
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#![warn(clippy::needless_range_loop)]
|
||||
#![allow(clippy::uninlined_format_args)]
|
||||
#![allow(clippy::uninlined_format_args, clippy::useless_vec)]
|
||||
|
||||
static STATIC: [usize; 4] = [0, 1, 8, 16];
|
||||
const CONST: [usize; 4] = [0, 1, 8, 16];
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#![warn(clippy::needless_range_loop)]
|
||||
#![allow(clippy::useless_vec)]
|
||||
|
||||
fn calc_idx(i: usize) -> usize {
|
||||
(i + i + 20) % 4
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: the loop variable `i` is only used to index `ns`
|
||||
--> $DIR/needless_range_loop2.rs:10:14
|
||||
--> $DIR/needless_range_loop2.rs:11:14
|
||||
|
|
||||
LL | for i in 3..10 {
|
||||
| ^^^^^
|
||||
|
@ -11,7 +11,7 @@ LL | for <item> in ns.iter().take(10).skip(3) {
|
|||
| ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: the loop variable `i` is only used to index `ms`
|
||||
--> $DIR/needless_range_loop2.rs:31:14
|
||||
--> $DIR/needless_range_loop2.rs:32:14
|
||||
|
|
||||
LL | for i in 0..ms.len() {
|
||||
| ^^^^^^^^^^^
|
||||
|
@ -22,7 +22,7 @@ LL | for <item> in &mut ms {
|
|||
| ~~~~~~ ~~~~~~~
|
||||
|
||||
error: the loop variable `i` is only used to index `ms`
|
||||
--> $DIR/needless_range_loop2.rs:37:14
|
||||
--> $DIR/needless_range_loop2.rs:38:14
|
||||
|
|
||||
LL | for i in 0..ms.len() {
|
||||
| ^^^^^^^^^^^
|
||||
|
@ -33,7 +33,7 @@ LL | for <item> in &mut ms {
|
|||
| ~~~~~~ ~~~~~~~
|
||||
|
||||
error: the loop variable `i` is only used to index `vec`
|
||||
--> $DIR/needless_range_loop2.rs:61:14
|
||||
--> $DIR/needless_range_loop2.rs:62:14
|
||||
|
|
||||
LL | for i in x..x + 4 {
|
||||
| ^^^^^^^^
|
||||
|
@ -44,7 +44,7 @@ LL | for <item> in vec.iter_mut().skip(x).take(4) {
|
|||
| ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: the loop variable `i` is only used to index `vec`
|
||||
--> $DIR/needless_range_loop2.rs:68:14
|
||||
--> $DIR/needless_range_loop2.rs:69:14
|
||||
|
|
||||
LL | for i in x..=x + 4 {
|
||||
| ^^^^^^^^^
|
||||
|
@ -55,7 +55,7 @@ LL | for <item> in vec.iter_mut().skip(x).take(4 + 1) {
|
|||
| ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: the loop variable `i` is only used to index `arr`
|
||||
--> $DIR/needless_range_loop2.rs:74:14
|
||||
--> $DIR/needless_range_loop2.rs:75:14
|
||||
|
|
||||
LL | for i in 0..3 {
|
||||
| ^^^^
|
||||
|
@ -66,7 +66,7 @@ LL | for <item> in &arr {
|
|||
| ~~~~~~ ~~~~
|
||||
|
||||
error: the loop variable `i` is only used to index `arr`
|
||||
--> $DIR/needless_range_loop2.rs:78:14
|
||||
--> $DIR/needless_range_loop2.rs:79:14
|
||||
|
|
||||
LL | for i in 0..2 {
|
||||
| ^^^^
|
||||
|
@ -77,7 +77,7 @@ LL | for <item> in arr.iter().take(2) {
|
|||
| ~~~~~~ ~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: the loop variable `i` is only used to index `arr`
|
||||
--> $DIR/needless_range_loop2.rs:82:14
|
||||
--> $DIR/needless_range_loop2.rs:83:14
|
||||
|
|
||||
LL | for i in 1..3 {
|
||||
| ^^^^
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
clippy::deref_addrof,
|
||||
clippy::redundant_field_names,
|
||||
clippy::uninlined_format_args,
|
||||
clippy::unnecessary_struct_initialization
|
||||
clippy::unnecessary_struct_initialization,
|
||||
clippy::useless_vec
|
||||
)]
|
||||
|
||||
struct Unit;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: statement with no effect
|
||||
--> $DIR/no_effect.rs:97:5
|
||||
--> $DIR/no_effect.rs:98:5
|
||||
|
|
||||
LL | 0;
|
||||
| ^^
|
||||
|
@ -7,151 +7,151 @@ LL | 0;
|
|||
= note: `-D clippy::no-effect` implied by `-D warnings`
|
||||
|
||||
error: statement with no effect
|
||||
--> $DIR/no_effect.rs:98:5
|
||||
--> $DIR/no_effect.rs:99:5
|
||||
|
|
||||
LL | s2;
|
||||
| ^^^
|
||||
|
||||
error: statement with no effect
|
||||
--> $DIR/no_effect.rs:99:5
|
||||
--> $DIR/no_effect.rs:100:5
|
||||
|
|
||||
LL | Unit;
|
||||
| ^^^^^
|
||||
|
||||
error: statement with no effect
|
||||
--> $DIR/no_effect.rs:100:5
|
||||
--> $DIR/no_effect.rs:101:5
|
||||
|
|
||||
LL | Tuple(0);
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: statement with no effect
|
||||
--> $DIR/no_effect.rs:101:5
|
||||
--> $DIR/no_effect.rs:102:5
|
||||
|
|
||||
LL | Struct { field: 0 };
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: statement with no effect
|
||||
--> $DIR/no_effect.rs:102:5
|
||||
--> $DIR/no_effect.rs:103:5
|
||||
|
|
||||
LL | Struct { ..s };
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: statement with no effect
|
||||
--> $DIR/no_effect.rs:103:5
|
||||
--> $DIR/no_effect.rs:104:5
|
||||
|
|
||||
LL | Union { a: 0 };
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: statement with no effect
|
||||
--> $DIR/no_effect.rs:104:5
|
||||
--> $DIR/no_effect.rs:105:5
|
||||
|
|
||||
LL | Enum::Tuple(0);
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: statement with no effect
|
||||
--> $DIR/no_effect.rs:105:5
|
||||
--> $DIR/no_effect.rs:106:5
|
||||
|
|
||||
LL | Enum::Struct { field: 0 };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: statement with no effect
|
||||
--> $DIR/no_effect.rs:106:5
|
||||
--> $DIR/no_effect.rs:107:5
|
||||
|
|
||||
LL | 5 + 6;
|
||||
| ^^^^^^
|
||||
|
||||
error: statement with no effect
|
||||
--> $DIR/no_effect.rs:107:5
|
||||
--> $DIR/no_effect.rs:108:5
|
||||
|
|
||||
LL | *&42;
|
||||
| ^^^^^
|
||||
|
||||
error: statement with no effect
|
||||
--> $DIR/no_effect.rs:108:5
|
||||
--> $DIR/no_effect.rs:109:5
|
||||
|
|
||||
LL | &6;
|
||||
| ^^^
|
||||
|
||||
error: statement with no effect
|
||||
--> $DIR/no_effect.rs:109:5
|
||||
--> $DIR/no_effect.rs:110:5
|
||||
|
|
||||
LL | (5, 6, 7);
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: statement with no effect
|
||||
--> $DIR/no_effect.rs:110:5
|
||||
--> $DIR/no_effect.rs:111:5
|
||||
|
|
||||
LL | ..;
|
||||
| ^^^
|
||||
|
||||
error: statement with no effect
|
||||
--> $DIR/no_effect.rs:111:5
|
||||
--> $DIR/no_effect.rs:112:5
|
||||
|
|
||||
LL | 5..;
|
||||
| ^^^^
|
||||
|
||||
error: statement with no effect
|
||||
--> $DIR/no_effect.rs:112:5
|
||||
--> $DIR/no_effect.rs:113:5
|
||||
|
|
||||
LL | ..5;
|
||||
| ^^^^
|
||||
|
||||
error: statement with no effect
|
||||
--> $DIR/no_effect.rs:113:5
|
||||
--> $DIR/no_effect.rs:114:5
|
||||
|
|
||||
LL | 5..6;
|
||||
| ^^^^^
|
||||
|
||||
error: statement with no effect
|
||||
--> $DIR/no_effect.rs:114:5
|
||||
--> $DIR/no_effect.rs:115:5
|
||||
|
|
||||
LL | 5..=6;
|
||||
| ^^^^^^
|
||||
|
||||
error: statement with no effect
|
||||
--> $DIR/no_effect.rs:115:5
|
||||
--> $DIR/no_effect.rs:116:5
|
||||
|
|
||||
LL | [42, 55];
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: statement with no effect
|
||||
--> $DIR/no_effect.rs:116:5
|
||||
--> $DIR/no_effect.rs:117:5
|
||||
|
|
||||
LL | [42, 55][1];
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: statement with no effect
|
||||
--> $DIR/no_effect.rs:117:5
|
||||
--> $DIR/no_effect.rs:118:5
|
||||
|
|
||||
LL | (42, 55).1;
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: statement with no effect
|
||||
--> $DIR/no_effect.rs:118:5
|
||||
--> $DIR/no_effect.rs:119:5
|
||||
|
|
||||
LL | [42; 55];
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: statement with no effect
|
||||
--> $DIR/no_effect.rs:119:5
|
||||
--> $DIR/no_effect.rs:120:5
|
||||
|
|
||||
LL | [42; 55][13];
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error: statement with no effect
|
||||
--> $DIR/no_effect.rs:121:5
|
||||
--> $DIR/no_effect.rs:122:5
|
||||
|
|
||||
LL | || x += 5;
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: statement with no effect
|
||||
--> $DIR/no_effect.rs:123:5
|
||||
--> $DIR/no_effect.rs:124:5
|
||||
|
|
||||
LL | FooString { s: s };
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: binding to `_` prefixed variable with no side-effect
|
||||
--> $DIR/no_effect.rs:124:5
|
||||
--> $DIR/no_effect.rs:125:5
|
||||
|
|
||||
LL | let _unused = 1;
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
@ -159,19 +159,19 @@ LL | let _unused = 1;
|
|||
= note: `-D clippy::no-effect-underscore-binding` implied by `-D warnings`
|
||||
|
||||
error: binding to `_` prefixed variable with no side-effect
|
||||
--> $DIR/no_effect.rs:125:5
|
||||
--> $DIR/no_effect.rs:126:5
|
||||
|
|
||||
LL | let _penguin = || println!("Some helpful closure");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: binding to `_` prefixed variable with no side-effect
|
||||
--> $DIR/no_effect.rs:126:5
|
||||
--> $DIR/no_effect.rs:127:5
|
||||
|
|
||||
LL | let _duck = Struct { field: 0 };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: binding to `_` prefixed variable with no side-effect
|
||||
--> $DIR/no_effect.rs:127:5
|
||||
--> $DIR/no_effect.rs:128:5
|
||||
|
|
||||
LL | let _cat = [2, 4, 6, 8][2];
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#![feature(lint_reasons)]
|
||||
#![allow(unused, clippy::diverging_sub_expression)]
|
||||
#![warn(clippy::nonminimal_bool)]
|
||||
#![allow(clippy::useless_vec)]
|
||||
|
||||
fn main() {
|
||||
let a: bool = unimplemented!();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: this boolean expression can be simplified
|
||||
--> $DIR/nonminimal_bool.rs:11:13
|
||||
--> $DIR/nonminimal_bool.rs:12:13
|
||||
|
|
||||
LL | let _ = !true;
|
||||
| ^^^^^ help: try: `false`
|
||||
|
@ -7,43 +7,43 @@ LL | let _ = !true;
|
|||
= note: `-D clippy::nonminimal-bool` implied by `-D warnings`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/nonminimal_bool.rs:12:13
|
||||
--> $DIR/nonminimal_bool.rs:13:13
|
||||
|
|
||||
LL | let _ = !false;
|
||||
| ^^^^^^ help: try: `true`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/nonminimal_bool.rs:13:13
|
||||
--> $DIR/nonminimal_bool.rs:14:13
|
||||
|
|
||||
LL | let _ = !!a;
|
||||
| ^^^ help: try: `a`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/nonminimal_bool.rs:14:13
|
||||
--> $DIR/nonminimal_bool.rs:15:13
|
||||
|
|
||||
LL | let _ = false || a;
|
||||
| ^^^^^^^^^^ help: try: `a`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/nonminimal_bool.rs:18:13
|
||||
--> $DIR/nonminimal_bool.rs:19:13
|
||||
|
|
||||
LL | let _ = !(!a && b);
|
||||
| ^^^^^^^^^^ help: try: `a || !b`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/nonminimal_bool.rs:19:13
|
||||
--> $DIR/nonminimal_bool.rs:20:13
|
||||
|
|
||||
LL | let _ = !(!a || b);
|
||||
| ^^^^^^^^^^ help: try: `a && !b`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/nonminimal_bool.rs:20:13
|
||||
--> $DIR/nonminimal_bool.rs:21:13
|
||||
|
|
||||
LL | let _ = !a && !(b && c);
|
||||
| ^^^^^^^^^^^^^^^ help: try: `!(a || b && c)`
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/nonminimal_bool.rs:28:13
|
||||
--> $DIR/nonminimal_bool.rs:29:13
|
||||
|
|
||||
LL | let _ = a == b && c == 5 && a == b;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -56,7 +56,7 @@ LL | let _ = a == b && c == 5;
|
|||
| ~~~~~~~~~~~~~~~~
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/nonminimal_bool.rs:29:13
|
||||
--> $DIR/nonminimal_bool.rs:30:13
|
||||
|
|
||||
LL | let _ = a == b || c == 5 || a == b;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -69,7 +69,7 @@ LL | let _ = a == b || c == 5;
|
|||
| ~~~~~~~~~~~~~~~~
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/nonminimal_bool.rs:30:13
|
||||
--> $DIR/nonminimal_bool.rs:31:13
|
||||
|
|
||||
LL | let _ = a == b && c == 5 && b == a;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -82,7 +82,7 @@ LL | let _ = a == b && c == 5;
|
|||
| ~~~~~~~~~~~~~~~~
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/nonminimal_bool.rs:31:13
|
||||
--> $DIR/nonminimal_bool.rs:32:13
|
||||
|
|
||||
LL | let _ = a != b || !(a != b || c == d);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -95,7 +95,7 @@ LL | let _ = a != b || c != d;
|
|||
| ~~~~~~~~~~~~~~~~
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/nonminimal_bool.rs:32:13
|
||||
--> $DIR/nonminimal_bool.rs:33:13
|
||||
|
|
||||
LL | let _ = a != b && !(a != b && c == d);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -108,7 +108,7 @@ LL | let _ = a != b && c != d;
|
|||
| ~~~~~~~~~~~~~~~~
|
||||
|
||||
error: this boolean expression can be simplified
|
||||
--> $DIR/nonminimal_bool.rs:62:8
|
||||
--> $DIR/nonminimal_bool.rs:63:8
|
||||
|
|
||||
LL | if matches!(true, true) && true {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `matches!(true, true)`
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//@run-rustfix
|
||||
|
||||
#![allow(unused, clippy::redundant_clone)]
|
||||
#![allow(unused, clippy::redundant_clone, clippy::useless_vec)]
|
||||
#![warn(clippy::option_as_ref_deref)]
|
||||
|
||||
use std::ffi::{CString, OsString};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//@run-rustfix
|
||||
|
||||
#![allow(unused, clippy::redundant_clone)]
|
||||
#![allow(unused, clippy::redundant_clone, clippy::useless_vec)]
|
||||
#![warn(clippy::option_as_ref_deref)]
|
||||
|
||||
use std::ffi::{CString, OsString};
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
//@run-rustfix
|
||||
#![warn(clippy::or_fun_call)]
|
||||
#![allow(dead_code)]
|
||||
#![allow(clippy::borrow_as_ptr, clippy::uninlined_format_args, clippy::unnecessary_wraps)]
|
||||
#![allow(
|
||||
clippy::borrow_as_ptr,
|
||||
clippy::uninlined_format_args,
|
||||
clippy::unnecessary_wraps,
|
||||
clippy::useless_vec
|
||||
)]
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
use std::collections::HashMap;
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
//@run-rustfix
|
||||
#![warn(clippy::or_fun_call)]
|
||||
#![allow(dead_code)]
|
||||
#![allow(clippy::borrow_as_ptr, clippy::uninlined_format_args, clippy::unnecessary_wraps)]
|
||||
#![allow(
|
||||
clippy::borrow_as_ptr,
|
||||
clippy::uninlined_format_args,
|
||||
clippy::unnecessary_wraps,
|
||||
clippy::useless_vec
|
||||
)]
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
use std::collections::HashMap;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: use of `unwrap_or` followed by a function call
|
||||
--> $DIR/or_fun_call.rs:48:22
|
||||
--> $DIR/or_fun_call.rs:53:22
|
||||
|
|
||||
LL | with_constructor.unwrap_or(make());
|
||||
| ^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(make)`
|
||||
|
@ -7,163 +7,163 @@ LL | with_constructor.unwrap_or(make());
|
|||
= note: `-D clippy::or-fun-call` implied by `-D warnings`
|
||||
|
||||
error: use of `unwrap_or` followed by a call to `new`
|
||||
--> $DIR/or_fun_call.rs:51:14
|
||||
--> $DIR/or_fun_call.rs:56:14
|
||||
|
|
||||
LL | with_new.unwrap_or(Vec::new());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_default()`
|
||||
|
||||
error: use of `unwrap_or` followed by a function call
|
||||
--> $DIR/or_fun_call.rs:54:21
|
||||
--> $DIR/or_fun_call.rs:59:21
|
||||
|
|
||||
LL | with_const_args.unwrap_or(Vec::with_capacity(12));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| Vec::with_capacity(12))`
|
||||
|
||||
error: use of `unwrap_or` followed by a function call
|
||||
--> $DIR/or_fun_call.rs:57:14
|
||||
--> $DIR/or_fun_call.rs:62:14
|
||||
|
|
||||
LL | with_err.unwrap_or(make());
|
||||
| ^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| make())`
|
||||
|
||||
error: use of `unwrap_or` followed by a function call
|
||||
--> $DIR/or_fun_call.rs:60:19
|
||||
--> $DIR/or_fun_call.rs:65:19
|
||||
|
|
||||
LL | with_err_args.unwrap_or(Vec::with_capacity(12));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| Vec::with_capacity(12))`
|
||||
|
||||
error: use of `unwrap_or` followed by a call to `default`
|
||||
--> $DIR/or_fun_call.rs:63:24
|
||||
--> $DIR/or_fun_call.rs:68:24
|
||||
|
|
||||
LL | with_default_trait.unwrap_or(Default::default());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_default()`
|
||||
|
||||
error: use of `unwrap_or` followed by a call to `default`
|
||||
--> $DIR/or_fun_call.rs:66:23
|
||||
--> $DIR/or_fun_call.rs:71:23
|
||||
|
|
||||
LL | with_default_type.unwrap_or(u64::default());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_default()`
|
||||
|
||||
error: use of `unwrap_or` followed by a function call
|
||||
--> $DIR/or_fun_call.rs:69:18
|
||||
--> $DIR/or_fun_call.rs:74:18
|
||||
|
|
||||
LL | self_default.unwrap_or(<FakeDefault>::default());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(<FakeDefault>::default)`
|
||||
|
||||
error: use of `unwrap_or` followed by a call to `default`
|
||||
--> $DIR/or_fun_call.rs:72:18
|
||||
--> $DIR/or_fun_call.rs:77:18
|
||||
|
|
||||
LL | real_default.unwrap_or(<FakeDefault as Default>::default());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_default()`
|
||||
|
||||
error: use of `unwrap_or` followed by a call to `new`
|
||||
--> $DIR/or_fun_call.rs:75:14
|
||||
--> $DIR/or_fun_call.rs:80:14
|
||||
|
|
||||
LL | with_vec.unwrap_or(vec![]);
|
||||
| ^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_default()`
|
||||
|
||||
error: use of `unwrap_or` followed by a function call
|
||||
--> $DIR/or_fun_call.rs:78:21
|
||||
--> $DIR/or_fun_call.rs:83:21
|
||||
|
|
||||
LL | without_default.unwrap_or(Foo::new());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(Foo::new)`
|
||||
|
||||
error: use of `or_insert` followed by a call to `new`
|
||||
--> $DIR/or_fun_call.rs:81:19
|
||||
--> $DIR/or_fun_call.rs:86:19
|
||||
|
|
||||
LL | map.entry(42).or_insert(String::new());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `or_default()`
|
||||
|
||||
error: use of `or_insert` followed by a call to `new`
|
||||
--> $DIR/or_fun_call.rs:84:23
|
||||
--> $DIR/or_fun_call.rs:89:23
|
||||
|
|
||||
LL | map_vec.entry(42).or_insert(vec![]);
|
||||
| ^^^^^^^^^^^^^^^^^ help: try this: `or_default()`
|
||||
|
||||
error: use of `or_insert` followed by a call to `new`
|
||||
--> $DIR/or_fun_call.rs:87:21
|
||||
--> $DIR/or_fun_call.rs:92:21
|
||||
|
|
||||
LL | btree.entry(42).or_insert(String::new());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `or_default()`
|
||||
|
||||
error: use of `or_insert` followed by a call to `new`
|
||||
--> $DIR/or_fun_call.rs:90:25
|
||||
--> $DIR/or_fun_call.rs:95:25
|
||||
|
|
||||
LL | btree_vec.entry(42).or_insert(vec![]);
|
||||
| ^^^^^^^^^^^^^^^^^ help: try this: `or_default()`
|
||||
|
||||
error: use of `unwrap_or` followed by a call to `new`
|
||||
--> $DIR/or_fun_call.rs:93:21
|
||||
--> $DIR/or_fun_call.rs:98:21
|
||||
|
|
||||
LL | let _ = stringy.unwrap_or(String::new());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_default()`
|
||||
|
||||
error: use of `unwrap_or` followed by a function call
|
||||
--> $DIR/or_fun_call.rs:101:21
|
||||
--> $DIR/or_fun_call.rs:106:21
|
||||
|
|
||||
LL | let _ = Some(1).unwrap_or(map[&1]);
|
||||
| ^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| map[&1])`
|
||||
|
||||
error: use of `unwrap_or` followed by a function call
|
||||
--> $DIR/or_fun_call.rs:103:21
|
||||
--> $DIR/or_fun_call.rs:108:21
|
||||
|
|
||||
LL | let _ = Some(1).unwrap_or(map[&1]);
|
||||
| ^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| map[&1])`
|
||||
|
||||
error: use of `or` followed by a function call
|
||||
--> $DIR/or_fun_call.rs:127:35
|
||||
--> $DIR/or_fun_call.rs:132:35
|
||||
|
|
||||
LL | let _ = Some("a".to_string()).or(Some("b".to_string()));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `or_else(|| Some("b".to_string()))`
|
||||
|
||||
error: use of `unwrap_or` followed by a function call
|
||||
--> $DIR/or_fun_call.rs:166:14
|
||||
--> $DIR/or_fun_call.rs:171:14
|
||||
|
|
||||
LL | None.unwrap_or(ptr_to_ref(s));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| ptr_to_ref(s))`
|
||||
|
||||
error: use of `unwrap_or` followed by a function call
|
||||
--> $DIR/or_fun_call.rs:172:14
|
||||
--> $DIR/or_fun_call.rs:177:14
|
||||
|
|
||||
LL | None.unwrap_or(unsafe { ptr_to_ref(s) });
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| unsafe { ptr_to_ref(s) })`
|
||||
|
||||
error: use of `unwrap_or` followed by a function call
|
||||
--> $DIR/or_fun_call.rs:174:14
|
||||
--> $DIR/or_fun_call.rs:179:14
|
||||
|
|
||||
LL | None.unwrap_or( unsafe { ptr_to_ref(s) } );
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| unsafe { ptr_to_ref(s) })`
|
||||
|
||||
error: use of `unwrap_or` followed by a call to `new`
|
||||
--> $DIR/or_fun_call.rs:188:14
|
||||
--> $DIR/or_fun_call.rs:193:14
|
||||
|
|
||||
LL | .unwrap_or(String::new());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_default()`
|
||||
|
||||
error: use of `unwrap_or` followed by a call to `new`
|
||||
--> $DIR/or_fun_call.rs:201:14
|
||||
--> $DIR/or_fun_call.rs:206:14
|
||||
|
|
||||
LL | .unwrap_or(String::new());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_default()`
|
||||
|
||||
error: use of `unwrap_or` followed by a call to `new`
|
||||
--> $DIR/or_fun_call.rs:213:14
|
||||
--> $DIR/or_fun_call.rs:218:14
|
||||
|
|
||||
LL | .unwrap_or(String::new());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_default()`
|
||||
|
||||
error: use of `unwrap_or` followed by a call to `new`
|
||||
--> $DIR/or_fun_call.rs:224:10
|
||||
--> $DIR/or_fun_call.rs:229:10
|
||||
|
|
||||
LL | .unwrap_or(String::new());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_default()`
|
||||
|
||||
error: use of `map_or` followed by a function call
|
||||
--> $DIR/or_fun_call.rs:249:25
|
||||
--> $DIR/or_fun_call.rs:254:25
|
||||
|
|
||||
LL | let _ = Some(4).map_or(g(), |v| v);
|
||||
| ^^^^^^^^^^^^^^^^^^ help: try this: `map_or_else(g, |v| v)`
|
||||
|
||||
error: use of `map_or` followed by a function call
|
||||
--> $DIR/or_fun_call.rs:250:25
|
||||
--> $DIR/or_fun_call.rs:255:25
|
||||
|
|
||||
LL | let _ = Some(4).map_or(g(), f);
|
||||
| ^^^^^^^^^^^^^^ help: try this: `map_or_else(g, f)`
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//@run-rustfix
|
||||
#![allow(clippy::unnecessary_cast)]
|
||||
#![allow(clippy::unnecessary_cast, clippy::useless_vec)]
|
||||
|
||||
fn main() {
|
||||
let vec = vec![b'a', b'b', b'c'];
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue