Skip to content
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

feat(lint): add default_iter_empty #8989

Merged
merged 1 commit into from Jun 17, 2022

Conversation

kyoto7250
Copy link
Contributor

@kyoto7250 kyoto7250 commented Jun 12, 2022

close #8915

This PR adds default_iter_empty lint.

This lint checks std::iter::Empty::default() and replace with std::iter::empty().

Thank you in advance.


changelog: add default_instead_of_iter_empty lint.

@rust-highfive
Copy link

r? @Alexendoo

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jun 12, 2022
@kyoto7250 kyoto7250 marked this pull request as ready for review June 12, 2022 23:15
@bors
Copy link
Collaborator

bors commented Jun 15, 2022

☔ The latest upstream changes (presumably #8964) made this pull request unmergeable. Please resolve the merge conflicts.

clippy_lints/src/default_iter_empty.rs Outdated Show resolved Hide resolved
clippy_lints/src/default_iter_empty.rs Outdated Show resolved Hide resolved
clippy_lints/src/default_iter_empty.rs Outdated Show resolved Hide resolved
clippy_lints/src/default_iter_empty.rs Outdated Show resolved Hide resolved
clippy_lints/src/default_iter_empty.rs Outdated Show resolved Hide resolved
tests/ui/default_iter_empty.rs Outdated Show resolved Hide resolved
@kyoto7250
Copy link
Contributor Author

@Alexendoo

I commited your suggestion.

Could I request your review?

@kyoto7250 kyoto7250 requested a review from Alexendoo June 16, 2022 13:45
@kyoto7250
Copy link
Contributor Author

I pushed some commits.

If we need to do git squash, please let me know.

@kyoto7250 kyoto7250 requested a review from Alexendoo June 17, 2022 02:00
@Alexendoo
Copy link
Member

Yeah a squash would be good thanks

Update description in clippy_lints/src/default_iter_empty.rs

Co-authored-by: Fridtjof Stoldt <xFrednet@gmail.com>

Update clippy_lints/src/default_iter_empty.rs

Co-authored-by: Alex Macleod <alex@macleod.io>

Update clippy_lints/src/default_iter_empty.rs

Co-authored-by: Alex Macleod <alex@macleod.io>

renamed default_iter_empty to default_instead_of_iter_empty

Avoid duplicate messages

add tests for regression

rewrite 'Why is this bad?'

cargo dev fmt

delete default_iter_empty lint in renamed_lint.rs

rewrite a message in the suggestion

cargo dev update_lints --check
@Alexendoo
Copy link
Member

Thanks!

@bors r+

@bors
Copy link
Collaborator

bors commented Jun 17, 2022

📌 Commit 2bb8c45 has been approved by Alexendoo

@bors
Copy link
Collaborator

bors commented Jun 17, 2022

⌛ Testing commit 2bb8c45 with merge e933bb6...

@bors
Copy link
Collaborator

bors commented Jun 17, 2022

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: Alexendoo
Pushing e933bb6 to master...

@bors bors merged commit e933bb6 into rust-lang:master Jun 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prefer std::iter::empty() to std::iter::Empty::default()
5 participants