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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add negation to len_zero lint to show more explicit message. #4314

Merged
merged 2 commits into from
Aug 1, 2019

Conversation

chansuke
Copy link
Contributor

@chansuke chansuke commented Jul 31, 2019

Fixes #4304 I have updated the len_zero to show the required negation in case of like the below case.

fn main() {
    let v = vec![1];
    if v.len() > 0 {        
    }
}

changelog: Clarify suggestion of len_zero lint.

Copy link
Member

@flip1995 flip1995 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -1,22 +0,0 @@
error: local variable doesn't need to be boxed here
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue with this test is fixed on the master branch. Please leave this file unchanged.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@flip1995 Thanks for the review!! Ok!I will fixe that later

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@flip1995 I fixed it:)

@flip1995 flip1995 added the S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) label Jul 31, 2019
@chansuke chansuke force-pushed the add-negation-to-is_empty branch from 293b0d7 to 2d467dc Compare August 1, 2019 11:05
@flip1995
Copy link
Member

flip1995 commented Aug 1, 2019

Oh, now you have to update the len_zero stderr file. :D

@chansuke
Copy link
Contributor Author

chansuke commented Aug 1, 2019

@flip1995 Oh, my bad. I pushed updated len_zero stderr file:)

@flip1995
Copy link
Member

flip1995 commented Aug 1, 2019

Thanks!

@bors r+

Side note: If your contribution fixes an issue, add "Fixes/Resolves/Closes" in front of the issue number, so the issue gets closed automatically. (Also in Clippy we require a "changelog: ..." line in the description). I added those for you, so this is just FYI and your next Clippy contribution 🎉 😉

@bors
Copy link
Contributor

bors commented Aug 1, 2019

📌 Commit ccc3257 has been approved by flip1995

bors added a commit that referenced this pull request Aug 1, 2019
Add negation to `len_zero` lint to show more explicit message.

Fixes #4304 I have updated the `len_zero` to show the required negation in case of like the below case.

```
fn main() {
    let v = vec![1];
    if v.len() > 0 {
    }
}
```

changelog: Clarify suggestion of `len_zero` lint.
@bors
Copy link
Contributor

bors commented Aug 1, 2019

⌛ Testing commit ccc3257 with merge 18a7dce...

@bors
Copy link
Contributor

bors commented Aug 1, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: flip1995
Pushing 18a7dce to master...

@bors bors merged commit ccc3257 into rust-lang:master Aug 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lint for is_empty doesn't show the required negation in the error message
3 participants