mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 15:14:29 +00:00
286 lines
14 KiB
Text
286 lines
14 KiB
Text
error: called `is_none()` after searching an `Iterator` with `find`
|
|
--> tests/ui/search_is_some_fixable_none.rs:9:13
|
|
|
|
|
LL | let _ = v.iter().find(|&x| *x < 0).is_none();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|x| *x < 0)`
|
|
|
|
|
= note: `-D clippy::search-is-some` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::search_is_some)]`
|
|
|
|
error: called `is_none()` after searching an `Iterator` with `find`
|
|
--> tests/ui/search_is_some_fixable_none.rs:10:13
|
|
|
|
|
LL | let _ = (0..1).find(|x| **y == *x).is_none(); // one dereference less
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!(0..1).any(|x| **y == x)`
|
|
|
|
error: called `is_none()` after searching an `Iterator` with `find`
|
|
--> tests/ui/search_is_some_fixable_none.rs:11:13
|
|
|
|
|
LL | let _ = (0..1).find(|x| *x == 0).is_none();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!(0..1).any(|x| x == 0)`
|
|
|
|
error: called `is_none()` after searching an `Iterator` with `find`
|
|
--> tests/ui/search_is_some_fixable_none.rs:12:13
|
|
|
|
|
LL | let _ = v.iter().find(|x| **x == 0).is_none();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|x| *x == 0)`
|
|
|
|
error: called `is_none()` after searching an `Iterator` with `find`
|
|
--> tests/ui/search_is_some_fixable_none.rs:13:13
|
|
|
|
|
LL | let _ = (4..5).find(|x| *x == 1 || *x == 3 || *x == 5).is_none();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!(4..5).any(|x| x == 1 || x == 3 || x == 5)`
|
|
|
|
error: called `is_none()` after searching an `Iterator` with `find`
|
|
--> tests/ui/search_is_some_fixable_none.rs:14:13
|
|
|
|
|
LL | let _ = (1..3).find(|x| [1, 2, 3].contains(x)).is_none();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!(1..3).any(|x| [1, 2, 3].contains(&x))`
|
|
|
|
error: called `is_none()` after searching an `Iterator` with `find`
|
|
--> tests/ui/search_is_some_fixable_none.rs:15:13
|
|
|
|
|
LL | let _ = (1..3).find(|x| *x == 0 || [1, 2, 3].contains(x)).is_none();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!(1..3).any(|x| x == 0 || [1, 2, 3].contains(&x))`
|
|
|
|
error: called `is_none()` after searching an `Iterator` with `find`
|
|
--> tests/ui/search_is_some_fixable_none.rs:16:13
|
|
|
|
|
LL | let _ = (1..3).find(|x| [1, 2, 3].contains(x) || *x == 0).is_none();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!(1..3).any(|x| [1, 2, 3].contains(&x) || x == 0)`
|
|
|
|
error: called `is_none()` after searching an `Iterator` with `find`
|
|
--> tests/ui/search_is_some_fixable_none.rs:17:13
|
|
|
|
|
LL | let _ = (1..3)
|
|
| _____________^
|
|
LL | | .find(|x| [1, 2, 3].contains(x) || *x == 0 || [4, 5, 6].contains(x) || *x == -1)
|
|
LL | | .is_none();
|
|
| |__________________^ help: consider using: `!(1..3).any(|x| [1, 2, 3].contains(&x) || x == 0 || [4, 5, 6].contains(&x) || x == -1)`
|
|
|
|
error: called `is_none()` after searching an `Iterator` with `position`
|
|
--> tests/ui/search_is_some_fixable_none.rs:22:13
|
|
|
|
|
LL | let _ = v.iter().position(|&x| x < 0).is_none();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|&x| x < 0)`
|
|
|
|
error: called `is_none()` after searching an `Iterator` with `rposition`
|
|
--> tests/ui/search_is_some_fixable_none.rs:25:13
|
|
|
|
|
LL | let _ = v.iter().rposition(|&x| x < 0).is_none();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|&x| x < 0)`
|
|
|
|
error: called `is_none()` after calling `find()` on a string
|
|
--> tests/ui/search_is_some_fixable_none.rs:31:13
|
|
|
|
|
LL | let _ = "hello world".find("world").is_none();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!"hello world".contains("world")`
|
|
|
|
error: called `is_none()` after calling `find()` on a string
|
|
--> tests/ui/search_is_some_fixable_none.rs:32:13
|
|
|
|
|
LL | let _ = "hello world".find(&s2).is_none();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!"hello world".contains(&s2)`
|
|
|
|
error: called `is_none()` after calling `find()` on a string
|
|
--> tests/ui/search_is_some_fixable_none.rs:33:13
|
|
|
|
|
LL | let _ = "hello world".find(&s2[2..]).is_none();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!"hello world".contains(&s2[2..])`
|
|
|
|
error: called `is_none()` after calling `find()` on a string
|
|
--> tests/ui/search_is_some_fixable_none.rs:35:13
|
|
|
|
|
LL | let _ = s1.find("world").is_none();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!s1.contains("world")`
|
|
|
|
error: called `is_none()` after calling `find()` on a string
|
|
--> tests/ui/search_is_some_fixable_none.rs:36:13
|
|
|
|
|
LL | let _ = s1.find(&s2).is_none();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!s1.contains(&s2)`
|
|
|
|
error: called `is_none()` after calling `find()` on a string
|
|
--> tests/ui/search_is_some_fixable_none.rs:37:13
|
|
|
|
|
LL | let _ = s1.find(&s2[2..]).is_none();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!s1.contains(&s2[2..])`
|
|
|
|
error: called `is_none()` after calling `find()` on a string
|
|
--> tests/ui/search_is_some_fixable_none.rs:39:13
|
|
|
|
|
LL | let _ = s1[2..].find("world").is_none();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!s1[2..].contains("world")`
|
|
|
|
error: called `is_none()` after calling `find()` on a string
|
|
--> tests/ui/search_is_some_fixable_none.rs:40:13
|
|
|
|
|
LL | let _ = s1[2..].find(&s2).is_none();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!s1[2..].contains(&s2)`
|
|
|
|
error: called `is_none()` after calling `find()` on a string
|
|
--> tests/ui/search_is_some_fixable_none.rs:41:13
|
|
|
|
|
LL | let _ = s1[2..].find(&s2[2..]).is_none();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!s1[2..].contains(&s2[2..])`
|
|
|
|
error: called `is_none()` after searching an `Iterator` with `find`
|
|
--> tests/ui/search_is_some_fixable_none.rs:57:25
|
|
|
|
|
LL | .filter(|c| filter_hand.iter().find(|cc| c == cc).is_none())
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!filter_hand.iter().any(|cc| c == &cc)`
|
|
|
|
error: called `is_none()` after searching an `Iterator` with `find`
|
|
--> tests/ui/search_is_some_fixable_none.rs:73:30
|
|
|
|
|
LL | .filter(|(c, _)| filter_hand.iter().find(|cc| c == *cc).is_none())
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!filter_hand.iter().any(|cc| c == cc)`
|
|
|
|
error: called `is_none()` after searching an `Iterator` with `find`
|
|
--> tests/ui/search_is_some_fixable_none.rs:84:17
|
|
|
|
|
LL | let _ = vfoo.iter().find(|v| v.foo == 1 && v.bar == 2).is_none();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!vfoo.iter().any(|v| v.foo == 1 && v.bar == 2)`
|
|
|
|
error: called `is_none()` after searching an `Iterator` with `find`
|
|
--> tests/ui/search_is_some_fixable_none.rs:87:17
|
|
|
|
|
LL | let _ = vfoo
|
|
| _________________^
|
|
LL | | .iter()
|
|
LL | | .find(|(i, v)| *i == 42 && v.foo == 1 && v.bar == 2)
|
|
LL | | .is_none();
|
|
| |______________________^
|
|
|
|
|
help: consider using
|
|
|
|
|
LL ~ let _ = !vfoo
|
|
LL ~ .iter().any(|(i, v)| *i == 42 && v.foo == 1 && v.bar == 2);
|
|
|
|
|
|
|
error: called `is_none()` after searching an `Iterator` with `find`
|
|
--> tests/ui/search_is_some_fixable_none.rs:95:17
|
|
|
|
|
LL | let _ = vfoo.iter().find(|a| a[0] == 42).is_none();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!vfoo.iter().any(|a| a[0] == 42)`
|
|
|
|
error: called `is_none()` after searching an `Iterator` with `find`
|
|
--> tests/ui/search_is_some_fixable_none.rs:101:17
|
|
|
|
|
LL | let _ = vfoo.iter().find(|sub| sub[1..4].len() == 3).is_none();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!vfoo.iter().any(|sub| sub[1..4].len() == 3)`
|
|
|
|
error: called `is_none()` after searching an `Iterator` with `find`
|
|
--> tests/ui/search_is_some_fixable_none.rs:119:17
|
|
|
|
|
LL | let _ = [ppx].iter().find(|ppp_x: &&&u32| please(**ppp_x)).is_none();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `![ppx].iter().any(|ppp_x: &&u32| please(ppp_x))`
|
|
|
|
error: called `is_none()` after searching an `Iterator` with `find`
|
|
--> tests/ui/search_is_some_fixable_none.rs:120:17
|
|
|
|
|
LL | let _ = [String::from("Hey hey")].iter().find(|s| s.len() == 2).is_none();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `![String::from("Hey hey")].iter().any(|s| s.len() == 2)`
|
|
|
|
error: called `is_none()` after searching an `Iterator` with `find`
|
|
--> tests/ui/search_is_some_fixable_none.rs:123:17
|
|
|
|
|
LL | let _ = v.iter().find(|x| deref_enough(**x)).is_none();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|x| deref_enough(*x))`
|
|
|
|
error: called `is_none()` after searching an `Iterator` with `find`
|
|
--> tests/ui/search_is_some_fixable_none.rs:124:17
|
|
|
|
|
LL | let _ = v.iter().find(|x: &&u32| deref_enough(**x)).is_none();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|x: &u32| deref_enough(*x))`
|
|
|
|
error: called `is_none()` after searching an `Iterator` with `find`
|
|
--> tests/ui/search_is_some_fixable_none.rs:127:17
|
|
|
|
|
LL | let _ = v.iter().find(|x| arg_no_deref(x)).is_none();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|x| arg_no_deref(&x))`
|
|
|
|
error: called `is_none()` after searching an `Iterator` with `find`
|
|
--> tests/ui/search_is_some_fixable_none.rs:129:17
|
|
|
|
|
LL | let _ = v.iter().find(|x: &&u32| arg_no_deref(x)).is_none();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|x: &u32| arg_no_deref(&x))`
|
|
|
|
error: called `is_none()` after searching an `Iterator` with `find`
|
|
--> tests/ui/search_is_some_fixable_none.rs:149:17
|
|
|
|
|
LL | let _ = vfoo
|
|
| _________________^
|
|
LL | | .iter()
|
|
LL | | .find(|v| v.inner_double.bar[0][0] == 2 && v.inner.bar[0] == 2)
|
|
LL | | .is_none();
|
|
| |______________________^
|
|
|
|
|
help: consider using
|
|
|
|
|
LL ~ let _ = !vfoo
|
|
LL ~ .iter().any(|v| v.inner_double.bar[0][0] == 2 && v.inner.bar[0] == 2);
|
|
|
|
|
|
|
error: called `is_none()` after searching an `Iterator` with `find`
|
|
--> tests/ui/search_is_some_fixable_none.rs:165:17
|
|
|
|
|
LL | let _ = vfoo.iter().find(|v| v.inner[0].bar == 2).is_none();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!vfoo.iter().any(|v| v.inner[0].bar == 2)`
|
|
|
|
error: called `is_none()` after searching an `Iterator` with `find`
|
|
--> tests/ui/search_is_some_fixable_none.rs:170:17
|
|
|
|
|
LL | let _ = vfoo.iter().find(|x| (**x)[0] == 9).is_none();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!vfoo.iter().any(|x| (**x)[0] == 9)`
|
|
|
|
error: called `is_none()` after searching an `Iterator` with `find`
|
|
--> tests/ui/search_is_some_fixable_none.rs:183:17
|
|
|
|
|
LL | let _ = vfoo.iter().find(|v| v.by_ref(&v.bar)).is_none();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!vfoo.iter().any(|v| v.by_ref(&v.bar))`
|
|
|
|
error: called `is_none()` after searching an `Iterator` with `find`
|
|
--> tests/ui/search_is_some_fixable_none.rs:187:17
|
|
|
|
|
LL | let _ = [&(&1, 2), &(&3, 4), &(&5, 4)].iter().find(|(&x, y)| x == *y).is_none();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `![&(&1, 2), &(&3, 4), &(&5, 4)].iter().any(|(&x, y)| x == *y)`
|
|
|
|
error: called `is_none()` after searching an `Iterator` with `find`
|
|
--> tests/ui/search_is_some_fixable_none.rs:188:17
|
|
|
|
|
LL | let _ = [&(&1, 2), &(&3, 4), &(&5, 4)].iter().find(|&(&x, y)| x == *y).is_none();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `![&(&1, 2), &(&3, 4), &(&5, 4)].iter().any(|(&x, y)| x == *y)`
|
|
|
|
error: called `is_none()` after searching an `Iterator` with `find`
|
|
--> tests/ui/search_is_some_fixable_none.rs:207:17
|
|
|
|
|
LL | let _ = v.iter().find(|s| s[0].is_empty()).is_none();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|s| s[0].is_empty())`
|
|
|
|
error: called `is_none()` after searching an `Iterator` with `find`
|
|
--> tests/ui/search_is_some_fixable_none.rs:208:17
|
|
|
|
|
LL | let _ = v.iter().find(|s| test_string_1(&s[0])).is_none();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|s| test_string_1(&s[0]))`
|
|
|
|
error: called `is_none()` after searching an `Iterator` with `find`
|
|
--> tests/ui/search_is_some_fixable_none.rs:217:17
|
|
|
|
|
LL | let _ = v.iter().find(|fp| fp.field.is_power_of_two()).is_none();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|fp| fp.field.is_power_of_two())`
|
|
|
|
error: called `is_none()` after searching an `Iterator` with `find`
|
|
--> tests/ui/search_is_some_fixable_none.rs:218:17
|
|
|
|
|
LL | let _ = v.iter().find(|fp| test_u32_1(fp.field)).is_none();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|fp| test_u32_1(fp.field))`
|
|
|
|
error: called `is_none()` after searching an `Iterator` with `find`
|
|
--> tests/ui/search_is_some_fixable_none.rs:219:17
|
|
|
|
|
LL | let _ = v.iter().find(|fp| test_u32_2(*fp.field)).is_none();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!v.iter().any(|fp| test_u32_2(*fp.field))`
|
|
|
|
error: aborting due to 43 previous errors
|
|
|