-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Use multipart suggestion in unnecessary_to_owned
#13847
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
Use multipart suggestion in unnecessary_to_owned
#13847
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Manishearth (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
Hey @nanvel , (not the reviewer, but I fixed all the other ones of these). You need to fix the lint, not the test. The test is intentionally badly structured, and the lint needs to emit a single multipart correction to fix it. Essentially this error here should be collapsed into a multipart:
The idea is, a lint that has multiple parts that need to be applied at once to be semantically correct needs to be applied as a multipart suggestion. At the moment the lint is providing multiple individual suggestions, the test framework applies them separately - which is why you get multiple output files that are each invalid. If you look at the linked issue you can check out any of my other PRs to see what I mean! |
@scottgerring thanks for the explanation. I rechecked the code, and it should indeed handle |
☔ The latest upstream changes (presumably 9f4941a) made this pull request unmergeable. Please resolve the merge conflicts. |
This comment has been minimized.
This comment has been minimized.
532d99b
to
4424887
Compare
@scottgerring, somehow, now it works, not sure why it was generating two fixed before. |
Hey @nanvel , Cool! I think it is because the issue with this test happened to be the same issue in the unnecessary_iter_cloned lint, which I fixed for that test yesterday (check out around Apologies - I didn't realize this was the only bit touching this test too - I would've expected unnecessary_to_owned to need a multipart change, but looking at it it seems that it's already good. Again, not the reviewer, but TL;DR enabling the test like you've done and checking those bits in I think should be it 🙌 You might want to squash your commits together with a sensible message( I think it's always a |
unnecessary_to_owned
unnecessary_to_owned
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.
I'm trusting @scottgerring assessment that this enough to fix the issue. You worked the most on this topic. Thanks for investigating!
Please squash your commits and this is ready to get merged.
2a9fe62
to
cbff019
Compare
cbff019
to
1e0b59d
Compare
@flip1995 commits were squashed. |
It is related to #13099
What was done:
@no-rustfix
fromtests/ui/unnecessary_to_owned.rs
src/methods/unnecessary_to_owned.rs
(there is already one multipart_suggestion, and I don't see any other)cargo uibless
I am new to Rust, and this is my first PR.
changelog: none