Commit 8151a17
committed
Auto merge of rust-lang#4049 - airt:fix-4033-search_is_some, r=flip1995
Fix rust-lang#4033 search_is_some
Fixes rust-lang#4033.
Suggest `any(|x| ..)` instead of `any(|&x| ..)` for `find(|&x| ..).is_some()` (Lint [search_is_some](https://rust-lang.github.io/rust-clippy/master/index.html#search_is_some))
FnDecl of `find`:
```rust
fn find<P>(&mut self, mut p: P) -> Option<Self::Item> where
P: FnMut(&Self::Item) -> bool
```
FnDecl of `any`:
```rust
fn any<F>(&mut self, mut f: F) -> bool where
F: FnMut(Self::Item) -> bool
```
If match on `|&_|` in closure of `find`, only use `|_|` in the suggestion.
PS. It's the first time that I have used the `hir` API, please correct me if there is any mistake 😺2 files changed
+18
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2059 | 2059 | | |
2060 | 2060 | | |
2061 | 2061 | | |
| 2062 | + | |
| 2063 | + | |
| 2064 | + | |
| 2065 | + | |
| 2066 | + | |
| 2067 | + | |
| 2068 | + | |
| 2069 | + | |
| 2070 | + | |
| 2071 | + | |
| 2072 | + | |
| 2073 | + | |
| 2074 | + | |
2062 | 2075 | | |
2063 | 2076 | | |
2064 | 2077 | | |
| |||
2067 | 2080 | | |
2068 | 2081 | | |
2069 | 2082 | | |
2070 | | - | |
2071 | | - | |
| 2083 | + | |
| 2084 | + | |
| 2085 | + | |
| 2086 | + | |
2072 | 2087 | | |
2073 | 2088 | | |
2074 | 2089 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
| 158 | + | |
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
| |||
0 commit comments