mirror of
https://github.com/rust-lang/rust-clippy
synced 2025-02-17 14:38:46 +00:00
Change variable named foo
and rerun update-all-references
This commit is contained in:
parent
56d252c53d
commit
5c1c50ee17
3 changed files with 14 additions and 22 deletions
|
@ -28,10 +28,10 @@ fn main() {
|
|||
).is_some();
|
||||
|
||||
// Check that we don't lint if the caller is not an `Iterator` or string
|
||||
let foo = IteratorFalsePositives { foo: 0 };
|
||||
let _ = foo.find().is_some();
|
||||
let _ = foo.position().is_some();
|
||||
let _ = foo.rposition().is_some();
|
||||
let falsepos = IteratorFalsePositives { foo: 0 };
|
||||
let _ = falsepos.find().is_some();
|
||||
let _ = falsepos.position().is_some();
|
||||
let _ = falsepos.rposition().is_some();
|
||||
// check that we don't lint if `find()` is called with
|
||||
// `Pattern` that is not a string
|
||||
let _ = "hello world".find(|c: char| c == 'o' || c == 'l').is_some();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
error: called `is_some()` after searching an `Iterator` with find
|
||||
error: called `is_some()` after searching an `Iterator` with `find`
|
||||
--> $DIR/search_is_some.rs:13:13
|
||||
|
|
||||
LL | let _ = v.iter().find(|&x| {
|
||||
|
@ -11,7 +11,7 @@ LL | | ).is_some();
|
|||
= note: `-D clippy::search-is-some` implied by `-D warnings`
|
||||
= help: this is more succinctly expressed by calling `any()`
|
||||
|
||||
error: called `is_some()` after searching an `Iterator` with position
|
||||
error: called `is_some()` after searching an `Iterator` with `position`
|
||||
--> $DIR/search_is_some.rs:19:13
|
||||
|
|
||||
LL | let _ = v.iter().position(|&x| {
|
||||
|
@ -23,7 +23,7 @@ LL | | ).is_some();
|
|||
|
|
||||
= help: this is more succinctly expressed by calling `any()`
|
||||
|
||||
error: called `is_some()` after searching an `Iterator` with rposition
|
||||
error: called `is_some()` after searching an `Iterator` with `rposition`
|
||||
--> $DIR/search_is_some.rs:25:13
|
||||
|
|
||||
LL | let _ = v.iter().rposition(|&x| {
|
||||
|
@ -35,13 +35,5 @@ LL | | ).is_some();
|
|||
|
|
||||
= help: this is more succinctly expressed by calling `any()`
|
||||
|
||||
error: use of a blacklisted/placeholder name `foo`
|
||||
--> $DIR/search_is_some.rs:31:9
|
||||
|
|
||||
LL | let foo = IteratorFalsePositives { foo: 0 };
|
||||
| ^^^
|
||||
|
|
||||
= note: `-D clippy::blacklisted-name` implied by `-D warnings`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
error: called `is_some()` after searching an `Iterator` with find
|
||||
error: called `is_some()` after searching an `Iterator` with `find`
|
||||
--> $DIR/search_is_some_fixable.rs:10:22
|
||||
|
|
||||
LL | let _ = v.iter().find(|&x| *x < 0).is_some();
|
||||
|
@ -6,31 +6,31 @@ LL | let _ = v.iter().find(|&x| *x < 0).is_some();
|
|||
|
|
||||
= note: `-D clippy::search-is-some` implied by `-D warnings`
|
||||
|
||||
error: called `is_some()` after searching an `Iterator` with find
|
||||
error: called `is_some()` after searching an `Iterator` with `find`
|
||||
--> $DIR/search_is_some_fixable.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
|
||||
error: called `is_some()` after searching an `Iterator` with `find`
|
||||
--> $DIR/search_is_some_fixable.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
|
||||
error: called `is_some()` after searching an `Iterator` with `find`
|
||||
--> $DIR/search_is_some_fixable.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 position
|
||||
error: called `is_some()` after searching an `Iterator` with `position`
|
||||
--> $DIR/search_is_some_fixable.rs:16: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
|
||||
error: called `is_some()` after searching an `Iterator` with `rposition`
|
||||
--> $DIR/search_is_some_fixable.rs:19:22
|
||||
|
|
||||
LL | let _ = v.iter().rposition(|&x| x < 0).is_some();
|
||||
|
|
Loading…
Add table
Reference in a new issue