Skip to content

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
Contributor

bors commented Sep 19, 2024

📌 Commit 290a01e has been approved by Manishearth

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Sep 19, 2024

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

@bors
Copy link
Contributor

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
10 checks passed
@lukaslueg lukaslueg deleted the issue11212 branch September 19, 2024 22:33
@bors bors mentioned this pull request Sep 19, 2024
6 tasks
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