-
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
Improve suggestions for several lints #6197
Conversation
r? @ebroto (rust_highfive has picked a reviewer for you, use r? to override) |
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.
Thanks for doing this!
Shouldn't we move the tests that now have MachineApplicable
to separate files enabling run-rustfix
?
tests/ui/map_unwrap_or.stderr
Outdated
| |_____________________________^ | ||
| | ||
= note: replace `map(|x| x + 1).unwrap_or_else(|| 0)` with `map_or_else(|| 0, |x| x + 1)` | ||
| |_____________________________^ help: try this: `opt.map_or_else(|| 0, |x| x + 1)` |
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.
much nicer and auto-applicable ❤️
Indeed. I hesitated to do so, as it hasn't been done before and is not so much work to do, so I was thinking maybe there was previous issues on this lint for auto-applicable suggestions 😄 |
I think those may predate auto-applicable suggestions, so that could be a reason it wasn't done before. I think we can give this a shot if you agree. |
9150895
to
e75534e
Compare
I wonder why multi-line cases are not giving suggestions. |
…p_unwrap_or` lints
9a203c9
to
c0dd1f9
Compare
@bors r+ Thanks!! |
📌 Commit c0dd1f9 has been approved by |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
This PR is a follow-up of this Zulip discussion.
It unifies placeholders for
methods
module and improves several suggestions forfilter_next
,filter_map_next
andmap_unwrap_or
lints.changelog: none