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

Initial impl of unnecessary_first_then_check #13421

Merged
merged 1 commit into from
Sep 19, 2024

Conversation

lukaslueg
Copy link
Contributor

Fixes #11212

Checks for {slice/vec/Box<[]>}.first().is_some() and suggests replacing the unnecessary Option-construct with a direct {slice/...}.is_empty(). Other lints guide constructs like if let Some(_) = v.get(0) into this, which end up as !v.is_empty().

changelog: [unnecessary_first_then_check]: Initial implementation

@rustbot
Copy link
Collaborator

rustbot commented Sep 19, 2024

r? @Manishearth

rustbot has assigned @Manishearth.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Sep 19, 2024
@Manishearth
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented Sep 19, 2024

📌 Commit 290a01e has been approved by Manishearth

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Sep 19, 2024

⌛ Testing commit 290a01e with merge 9be28b1...

@bors
Copy link
Collaborator

bors commented Sep 19, 2024

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: Manishearth
Pushing 9be28b1 to master...

@bors bors merged commit 9be28b1 into rust-lang:master Sep 19, 2024
11 checks passed
@lukaslueg lukaslueg deleted the issue11212 branch September 19, 2024 22:33
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.

clippy could suggest .is_empty() for more things
4 participants