-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Flag bufreader.lines().filter_map(Result::ok)
as suspicious
#10534
Conversation
r? @flip1995 (rustbot has picked a reviewer for you, use r? to override) |
eb59e32
to
1f4c5a2
Compare
Wow this is awesome! Thanks! I'm new to clippy lints but if I understand correctly, this checks that there is a There is a variation of this that I've seen with The same pattern also happens with |
Yes.
I'll have a look, as there is a lint for possible η-reduction but it is activated only in pedantic mode.
Indeed. |
☔ The latest upstream changes (presumably #10489) made this pull request unmergeable. Please resolve the merge conflicts. |
32ff41c
to
1023cf0
Compare
The proposed lint now triggers with anything returning A lintcheck with the 500 top most downloaded recent crates shows no hit. |
d04dab1
to
51b6693
Compare
☔ The latest upstream changes (presumably #9102) made this pull request unmergeable. Please resolve the merge conflicts. |
a2e445a
to
b3bff31
Compare
r? @llogiq |
I wonder why we should lint |
On Linux :
|
Ok then. I think the docs could use some editing for wording, otherwise it looks ok. |
b3bff31
to
97cf9a7
Compare
I have reworked the wording, tell me if you'd change other things. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only possible problem is that the user could check for in.is_file()
manually, in which case we'd have a false positive. That said, I'd be ok with just adding that to the "known problems" section, as the code to check for this case could be quite hairy
Note that even if I've added a "Known problems" section to the lint. I've used "suspicious" as a category. Is that ok, or do you prefer it to be put in the "nursery"? |
97cf9a7
to
e5f5233
Compare
e5f5233
to
6601d85
Compare
I think suspicious is likely fine, as the lint highlights a real problem and I haven't encountered a case where ignoring an error on one line would have produced a good outcome. @bors r+ |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
1 similar comment
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
This lint detects a problem that happened recently in https://github.com/uutils/coreutils and is described in rust-lang/rust#64144.
changelog: [
lines_filter_map_ok
]: new lint