mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 07:00:55 +00:00
268 lines
13 KiB
Text
268 lines
13 KiB
Text
error: called `is_some()` after searching an `Iterator` with `find`
|
|
--> $DIR/search_is_some_fixable_some.rs:10:22
|
|
|
|
|
LL | let _ = v.iter().find(|&x| *x < 0).is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `any()` instead: `any(|x| *x < 0)`
|
|
|
|
|
= note: `-D clippy::search-is-some` implied by `-D warnings`
|
|
|
|
error: called `is_some()` after searching an `Iterator` with `find`
|
|
--> $DIR/search_is_some_fixable_some.rs:11:20
|
|
|
|
|
LL | let _ = (0..1).find(|x| **y == *x).is_some(); // one dereference less
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `any()` instead: `any(|x| **y == x)`
|
|
|
|
error: called `is_some()` after searching an `Iterator` with `find`
|
|
--> $DIR/search_is_some_fixable_some.rs:12:20
|
|
|
|
|
LL | let _ = (0..1).find(|x| *x == 0).is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `any()` instead: `any(|x| x == 0)`
|
|
|
|
error: called `is_some()` after searching an `Iterator` with `find`
|
|
--> $DIR/search_is_some_fixable_some.rs:13:22
|
|
|
|
|
LL | let _ = v.iter().find(|x| **x == 0).is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `any()` instead: `any(|x| *x == 0)`
|
|
|
|
error: called `is_some()` after searching an `Iterator` with `find`
|
|
--> $DIR/search_is_some_fixable_some.rs:14:20
|
|
|
|
|
LL | let _ = (4..5).find(|x| *x == 1 || *x == 3 || *x == 5).is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `any()` instead: `any(|x| x == 1 || x == 3 || x == 5)`
|
|
|
|
error: called `is_some()` after searching an `Iterator` with `find`
|
|
--> $DIR/search_is_some_fixable_some.rs:15:20
|
|
|
|
|
LL | let _ = (1..3).find(|x| [1, 2, 3].contains(x)).is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `any()` instead: `any(|x| [1, 2, 3].contains(&x))`
|
|
|
|
error: called `is_some()` after searching an `Iterator` with `find`
|
|
--> $DIR/search_is_some_fixable_some.rs:16:20
|
|
|
|
|
LL | let _ = (1..3).find(|x| *x == 0 || [1, 2, 3].contains(x)).is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `any()` instead: `any(|x| x == 0 || [1, 2, 3].contains(&x))`
|
|
|
|
error: called `is_some()` after searching an `Iterator` with `find`
|
|
--> $DIR/search_is_some_fixable_some.rs:17:20
|
|
|
|
|
LL | let _ = (1..3).find(|x| [1, 2, 3].contains(x) || *x == 0).is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `any()` instead: `any(|x| [1, 2, 3].contains(&x) || x == 0)`
|
|
|
|
error: called `is_some()` after searching an `Iterator` with `find`
|
|
--> $DIR/search_is_some_fixable_some.rs:19:10
|
|
|
|
|
LL | .find(|x| [1, 2, 3].contains(x) || *x == 0 || [4, 5, 6].contains(x) || *x == -1)
|
|
| __________^
|
|
LL | | .is_some();
|
|
| |__________________^ help: use `any()` instead: `any(|x| [1, 2, 3].contains(&x) || x == 0 || [4, 5, 6].contains(&x) || x == -1)`
|
|
|
|
error: called `is_some()` after searching an `Iterator` with `position`
|
|
--> $DIR/search_is_some_fixable_some.rs:23:22
|
|
|
|
|
LL | let _ = v.iter().position(|&x| x < 0).is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `any()` instead: `any(|&x| x < 0)`
|
|
|
|
error: called `is_some()` after searching an `Iterator` with `rposition`
|
|
--> $DIR/search_is_some_fixable_some.rs:26:22
|
|
|
|
|
LL | let _ = v.iter().rposition(|&x| x < 0).is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `any()` instead: `any(|&x| x < 0)`
|
|
|
|
error: called `is_some()` after calling `find()` on a string
|
|
--> $DIR/search_is_some_fixable_some.rs:31:27
|
|
|
|
|
LL | let _ = "hello world".find("world").is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^ help: use `contains()` instead: `contains("world")`
|
|
|
|
error: called `is_some()` after calling `find()` on a string
|
|
--> $DIR/search_is_some_fixable_some.rs:32:27
|
|
|
|
|
LL | let _ = "hello world".find(&s2).is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^ help: use `contains()` instead: `contains(&s2)`
|
|
|
|
error: called `is_some()` after calling `find()` on a string
|
|
--> $DIR/search_is_some_fixable_some.rs:33:27
|
|
|
|
|
LL | let _ = "hello world".find(&s2[2..]).is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: use `contains()` instead: `contains(&s2[2..])`
|
|
|
|
error: called `is_some()` after calling `find()` on a string
|
|
--> $DIR/search_is_some_fixable_some.rs:35:16
|
|
|
|
|
LL | let _ = s1.find("world").is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^ help: use `contains()` instead: `contains("world")`
|
|
|
|
error: called `is_some()` after calling `find()` on a string
|
|
--> $DIR/search_is_some_fixable_some.rs:36:16
|
|
|
|
|
LL | let _ = s1.find(&s2).is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^ help: use `contains()` instead: `contains(&s2)`
|
|
|
|
error: called `is_some()` after calling `find()` on a string
|
|
--> $DIR/search_is_some_fixable_some.rs:37:16
|
|
|
|
|
LL | let _ = s1.find(&s2[2..]).is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: use `contains()` instead: `contains(&s2[2..])`
|
|
|
|
error: called `is_some()` after calling `find()` on a string
|
|
--> $DIR/search_is_some_fixable_some.rs:39:21
|
|
|
|
|
LL | let _ = s1[2..].find("world").is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^ help: use `contains()` instead: `contains("world")`
|
|
|
|
error: called `is_some()` after calling `find()` on a string
|
|
--> $DIR/search_is_some_fixable_some.rs:40:21
|
|
|
|
|
LL | let _ = s1[2..].find(&s2).is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^ help: use `contains()` instead: `contains(&s2)`
|
|
|
|
error: called `is_some()` after calling `find()` on a string
|
|
--> $DIR/search_is_some_fixable_some.rs:41:21
|
|
|
|
|
LL | let _ = s1[2..].find(&s2[2..]).is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: use `contains()` instead: `contains(&s2[2..])`
|
|
|
|
error: called `is_some()` after searching an `Iterator` with `find`
|
|
--> $DIR/search_is_some_fixable_some.rs:57:44
|
|
|
|
|
LL | .filter(|c| filter_hand.iter().find(|cc| c == cc).is_some())
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `any()` instead: `any(|cc| c == &cc)`
|
|
|
|
error: called `is_some()` after searching an `Iterator` with `find`
|
|
--> $DIR/search_is_some_fixable_some.rs:73:49
|
|
|
|
|
LL | .filter(|(c, _)| filter_hand.iter().find(|cc| c == *cc).is_some())
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `any()` instead: `any(|cc| c == cc)`
|
|
|
|
error: called `is_some()` after searching an `Iterator` with `find`
|
|
--> $DIR/search_is_some_fixable_some.rs:84:29
|
|
|
|
|
LL | let _ = vfoo.iter().find(|v| v.foo == 1 && v.bar == 2).is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `any()` instead: `any(|v| v.foo == 1 && v.bar == 2)`
|
|
|
|
error: called `is_some()` after searching an `Iterator` with `find`
|
|
--> $DIR/search_is_some_fixable_some.rs:89:14
|
|
|
|
|
LL | .find(|(i, v)| *i == 42 && v.foo == 1 && v.bar == 2)
|
|
| ______________^
|
|
LL | | .is_some();
|
|
| |______________________^ help: use `any()` instead: `any(|(i, v)| *i == 42 && v.foo == 1 && v.bar == 2)`
|
|
|
|
error: called `is_some()` after searching an `Iterator` with `find`
|
|
--> $DIR/search_is_some_fixable_some.rs:95:29
|
|
|
|
|
LL | let _ = vfoo.iter().find(|a| a[0] == 42).is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `any()` instead: `any(|a| a[0] == 42)`
|
|
|
|
error: called `is_some()` after searching an `Iterator` with `find`
|
|
--> $DIR/search_is_some_fixable_some.rs:101:29
|
|
|
|
|
LL | let _ = vfoo.iter().find(|sub| sub[1..4].len() == 3).is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `any()` instead: `any(|sub| sub[1..4].len() == 3)`
|
|
|
|
error: called `is_some()` after searching an `Iterator` with `find`
|
|
--> $DIR/search_is_some_fixable_some.rs:119:30
|
|
|
|
|
LL | let _ = [ppx].iter().find(|ppp_x: &&&u32| please(**ppp_x)).is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `any()` instead: `any(|ppp_x: &&u32| please(ppp_x))`
|
|
|
|
error: called `is_some()` after searching an `Iterator` with `find`
|
|
--> $DIR/search_is_some_fixable_some.rs:120:50
|
|
|
|
|
LL | let _ = [String::from("Hey hey")].iter().find(|s| s.len() == 2).is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `any()` instead: `any(|s| s.len() == 2)`
|
|
|
|
error: called `is_some()` after searching an `Iterator` with `find`
|
|
--> $DIR/search_is_some_fixable_some.rs:123:26
|
|
|
|
|
LL | let _ = v.iter().find(|x| deref_enough(**x)).is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `any()` instead: `any(|x| deref_enough(*x))`
|
|
|
|
error: called `is_some()` after searching an `Iterator` with `find`
|
|
--> $DIR/search_is_some_fixable_some.rs:124:26
|
|
|
|
|
LL | let _ = v.iter().find(|x: &&u32| deref_enough(**x)).is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `any()` instead: `any(|x: &u32| deref_enough(*x))`
|
|
|
|
error: called `is_some()` after searching an `Iterator` with `find`
|
|
--> $DIR/search_is_some_fixable_some.rs:127:26
|
|
|
|
|
LL | let _ = v.iter().find(|x| arg_no_deref(x)).is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `any()` instead: `any(|x| arg_no_deref(&x))`
|
|
|
|
error: called `is_some()` after searching an `Iterator` with `find`
|
|
--> $DIR/search_is_some_fixable_some.rs:129:26
|
|
|
|
|
LL | let _ = v.iter().find(|x: &&u32| arg_no_deref(x)).is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `any()` instead: `any(|x: &u32| arg_no_deref(&x))`
|
|
|
|
error: called `is_some()` after searching an `Iterator` with `find`
|
|
--> $DIR/search_is_some_fixable_some.rs:151:14
|
|
|
|
|
LL | .find(|v| v.inner_double.bar[0][0] == 2 && v.inner.bar[0] == 2)
|
|
| ______________^
|
|
LL | | .is_some();
|
|
| |______________________^ help: use `any()` instead: `any(|v| v.inner_double.bar[0][0] == 2 && v.inner.bar[0] == 2)`
|
|
|
|
error: called `is_some()` after searching an `Iterator` with `find`
|
|
--> $DIR/search_is_some_fixable_some.rs:165:29
|
|
|
|
|
LL | let _ = vfoo.iter().find(|v| v.inner[0].bar == 2).is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `any()` instead: `any(|v| v.inner[0].bar == 2)`
|
|
|
|
error: called `is_some()` after searching an `Iterator` with `find`
|
|
--> $DIR/search_is_some_fixable_some.rs:170:29
|
|
|
|
|
LL | let _ = vfoo.iter().find(|x| (**x)[0] == 9).is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `any()` instead: `any(|x| (**x)[0] == 9)`
|
|
|
|
error: called `is_some()` after searching an `Iterator` with `find`
|
|
--> $DIR/search_is_some_fixable_some.rs:183:29
|
|
|
|
|
LL | let _ = vfoo.iter().find(|v| v.by_ref(&v.bar)).is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `any()` instead: `any(|v| v.by_ref(&v.bar))`
|
|
|
|
error: called `is_some()` after searching an `Iterator` with `find`
|
|
--> $DIR/search_is_some_fixable_some.rs:187:55
|
|
|
|
|
LL | let _ = [&(&1, 2), &(&3, 4), &(&5, 4)].iter().find(|(&x, y)| x == *y).is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `any()` instead: `any(|(&x, y)| x == *y)`
|
|
|
|
error: called `is_some()` after searching an `Iterator` with `find`
|
|
--> $DIR/search_is_some_fixable_some.rs:188:55
|
|
|
|
|
LL | let _ = [&(&1, 2), &(&3, 4), &(&5, 4)].iter().find(|&(&x, y)| x == *y).is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `any()` instead: `any(|(&x, y)| x == *y)`
|
|
|
|
error: called `is_some()` after searching an `Iterator` with `find`
|
|
--> $DIR/search_is_some_fixable_some.rs:207:26
|
|
|
|
|
LL | let _ = v.iter().find(|s| s[0].is_empty()).is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `any()` instead: `any(|s| s[0].is_empty())`
|
|
|
|
error: called `is_some()` after searching an `Iterator` with `find`
|
|
--> $DIR/search_is_some_fixable_some.rs:208:26
|
|
|
|
|
LL | let _ = v.iter().find(|s| test_string_1(&s[0])).is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `any()` instead: `any(|s| test_string_1(&s[0]))`
|
|
|
|
error: called `is_some()` after searching an `Iterator` with `find`
|
|
--> $DIR/search_is_some_fixable_some.rs:217:26
|
|
|
|
|
LL | let _ = v.iter().find(|fp| fp.field.is_power_of_two()).is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `any()` instead: `any(|fp| fp.field.is_power_of_two())`
|
|
|
|
error: called `is_some()` after searching an `Iterator` with `find`
|
|
--> $DIR/search_is_some_fixable_some.rs:218:26
|
|
|
|
|
LL | let _ = v.iter().find(|fp| test_u32_1(fp.field)).is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `any()` instead: `any(|fp| test_u32_1(fp.field))`
|
|
|
|
error: called `is_some()` after searching an `Iterator` with `find`
|
|
--> $DIR/search_is_some_fixable_some.rs:219:26
|
|
|
|
|
LL | let _ = v.iter().find(|fp| test_u32_2(*fp.field)).is_some();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `any()` instead: `any(|fp| test_u32_2(*fp.field))`
|
|
|
|
error: aborting due to 43 previous errors
|
|
|