rust-clippy
rust-clippy copied to clipboard
Add lint recommending using `std::iter::once` and `std::iter::empty`
changelog: [`iter_once`]: add new lint
changelog: [`iter_empty`]: add new lint
fixes #9186
- [ ] Followed lint naming conventions
- [x] Added passing UI tests (including committed
.stderr
file) - [x]
cargo test
passes locally - [x] Executed
cargo dev update_lints
- [x] Added lint documentation
- [x] Run
cargo dev fmt
The lint doesn't really follow the naming conventions. I don't have any better idea so I'm open to suggestions.
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @flip1995 (or someone else) soon.
Please see the contribution instructions for more information.
:umbrella: The latest upstream changes (presumably #9148) made this pull request unmergeable. Please resolve the merge conflicts.
Thanks for doing the analysis (https://github.com/rust-lang/rust-clippy/pull/9187#discussion_r928122711). I nominated this PR for the meeting this evening to figure out if we want to get this lint into pedantic
or have it in nursery
for starters.
The meeting is at 3pm UTC: https://everytimezone.com/s/deeec323
So in the Clippy meeting, we decided to place those lints in nursery
for now and lift them up to pedantic
once at least the most obvious FPs are addressed. Jarcho left some instructions on how this could be done here. However I don't want to block this PR on this.
I see on Zulip you proposed iter_on_empty_collection
for the name of iter_empty
. I like it. I suggest iter_on_singleton
for iter_once
I think of something different when I think about singletons. How about iter_on_single_items
?
also make sure to use the plural form, so iter_on_empty_collections
. That sounds better with allow
.
Can you squash the commits a bit further, please? Most of those are trivial/one-line changes, that we don't really need in the Clippy history.
:umbrella: The latest upstream changes (presumably #9302) made this pull request unmergeable. Please resolve the merge conflicts.
Is it squashed enough now or do you want even more?
Commits f30d7c2 and b247594 could also be squashed just looking at the commit message. But that's just me being pedantic, so I won't block this PR on that.
Thanks for squashing. That's how I (almost :yum:) like my commit messages.
@bors r+
:pushpin: Commit af4885c0cde76bf1faace76dc8fb53d3d4791422 has been approved by flip1995
It is now in the queue for this repository.
:hourglass: Testing commit af4885c0cde76bf1faace76dc8fb53d3d4791422 with merge 679fa9f2bfbdb65f0eb7732fa20043fd0f6813a8...
:sunny: Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test Approved by: flip1995 Pushing 679fa9f2bfbdb65f0eb7732fa20043fd0f6813a8 to master...