Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #4033 search_is_some #4049

Merged
merged 5 commits into from May 2, 2019

Conversation

Projects
None yet
3 participants
@airt
Copy link
Contributor

commented Apr 30, 2019

Fixes #4033.

Suggest any(|x| ..) instead of any(|&x| ..) for find(|&x| ..).is_some() (Lint search_is_some)

FnDecl of find:

fn find<P>(&mut self, mut p: P) -> Option<Self::Item> where
    P: FnMut(&Self::Item) -> bool

FnDecl of any:

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 馃樅

@flip1995

This comment has been minimized.

Copy link
Collaborator

commented Apr 30, 2019

Also rustfmt. Everything else LGTM

@flip1995

This comment has been minimized.

Copy link
Collaborator

commented May 2, 2019

Thanks!

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

commented May 2, 2019

馃搶 Commit d063516 has been approved by flip1995

@bors

This comment has been minimized.

Copy link
Contributor

commented May 2, 2019

鈱涳笍 Testing commit d063516 with merge 8151a17...

bors added a commit that referenced this pull request May 2, 2019

Auto merge of #4049 - airt:fix-4033-search_is_some, r=flip1995
Fix #4033 search_is_some

Fixes #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 馃樅
@bors

This comment has been minimized.

Copy link
Contributor

commented May 2, 2019

鈽锔 Test successful - checks-travis, status-appveyor
Approved by: flip1995
Pushing 8151a17 to master...

@bors bors merged commit d063516 into rust-lang:master May 2, 2019

2 checks passed

Travis CI - Pull Request Build Passed
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can鈥檛 perform that action at this time.