-
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
Extend iter_on
lints to catch more cases
#11038
Conversation
r? @dswij (rustbot has picked a reviewer for you, use r? to override) |
iter_on
to catch more casesiter_on
lints to catch more cases
Oh I meant with the new implementation, they're all annotated with https://github.com/Centri3/rust-clippy/blob/401797bbae28b88bfcc7c3089af09b5cb4bb90c0/tests/ui/iter_on_empty_collections.fixed#L26-L31 |
Yeah, I'll review it once we know what FP got fixed 😅 |
☔ The latest upstream changes (presumably #11095) made this pull request unmergeable. Please resolve the merge conflicts. |
I gave making the |
☔ The latest upstream changes (presumably #11166) made this pull request unmergeable. Please resolve the merge conflicts. |
☔ The latest upstream changes (presumably #11031) made this pull request unmergeable. Please resolve the merge conflicts. |
Assigning this to you since you've taken a look and have review privilege now r? @blyxyas |
rust-lang/rust#114070 was accepted, please wait until the next sync (which will also change Clippy's toolchain version) to do this change (it won't work before that :) ). It will sync about 2 or 3 days from now AFAIK. |
Add `sym::iter_mut` + `sym::as_mut_ptr` for Clippy We currently have `sym::iter` and `sym::iter_repeat`, this PR adds `sym::iter_mut` as it's useful for rust-lang/rust-clippy#11038 and another Clippy lint, it also adds `sym::as_mut_ptr` as it's useful for rust-lang/rust-clippy#10962.
Add `sym::iter_mut` + `sym::as_mut_ptr` for Clippy We currently have `sym::iter` and `sym::iter_repeat`, this PR adds `sym::iter_mut` as it's useful for rust-lang#11038 and another Clippy lint, it also adds `sym::as_mut_ptr` as it's useful for rust-lang#10962.
☔ The latest upstream changes (presumably #11250) made this pull request unmergeable. Please resolve the merge conflicts. |
Good news! #11250 got merged, merging |
Only 2 more FPs before this can (probably) be uplifted to |
Forgot to ask, I assumed that you wanted to fix those 2 FPs and uplift all in this PR. Do you wish to fix those in a future PR? Is this ready for another review? |
Yeah this is ready for another, I think the 2nd was caused by this rewrite so I intend to fix that but I'm unsure about the other. Ideally both would be fixed in this PR |
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.
Just some finishing touches and I think this is pretty ready.
/// | ||
/// ### Why is this bad? | ||
/// It is simpler to use the once function from the standard library. |
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.
/// It is simpler to use the once function from the standard library. | |
/// It is simpler to use the [`once`](https://doc.rust-lang.org/std/iter/fn.once.html) function from the standard library. |
/// ### Known problems | ||
/// The type of the resulting iterator might become incompatible with its usage. |
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.
It should probably mention the reason, that it is a core::iter::sources::once::Once<T>
instead of a core::slice::iter::Iter<T>
, but it should work fine as Once
also implements Iterator
/// | ||
/// It is simpler to use the empty function from the standard library: | ||
/// ### Known problems | ||
/// The type of the resulting iterator might become incompatible with its usage. |
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.
(Same as comment above 🐮 )
Also, I didn't really understand: Will you work on this PR to fix those FPs, or open another PR in the future uplifting this lint to |
Ideally, yes, I want this to be |
☔ The latest upstream changes (presumably #11239) made this pull request unmergeable. Please resolve the merge conflicts. |
Hey this is triage, I'm closing this due to inactivity. Currently, @Centri3 sadly doesn't have the time to continue this implementation. If anyone is interested in continuing this PR, you're more than welcome to create a new PR and push it over the finish line. :D Thank you to @Centri3 and the reviewers for the time, that you already put into this! @rustbot label +S-inactive-closed -S-waiting-on-author -S-waiting-on-review |
I've moved this to
pedantic
, unfortunately notstyle
as there are still a few FPs that need to be sorted out.changelog: Enhancement: [
iter_on_single_items
], [iter_on_empty_collections
]: Catch more cases