Skip to content

Simplify is_some() && …unwrap() to is_some_and in unit_arg#17055

Merged
llogiq merged 1 commit into
rust-lang:masterfrom
shulaoda:05-23-simplify_is_some_unwrap_to_is_some_and_in_unit_arg
May 22, 2026
Merged

Simplify is_some() && …unwrap() to is_some_and in unit_arg#17055
llogiq merged 1 commit into
rust-lang:masterfrom
shulaoda:05-23-simplify_is_some_unwrap_to_is_some_and_in_unit_arg

Conversation

@shulaoda

Copy link
Copy Markdown
Contributor

Summary

  • is_expr_default_nested in clippy_lints/src/unit_types/unit_arg.rs was
    written as block.expr.is_some() && is_expr_default_nested(cx, block.expr.unwrap()),
    which is exactly the pattern that clippy's own unnecessary_unwrap lint flags.
  • Replace it with block.expr.is_some_and(|e| is_expr_default_nested(cx, e)).

changelog: none

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label May 22, 2026
@rustbot

rustbot commented May 22, 2026

Copy link
Copy Markdown
Collaborator

r? @llogiq

rustbot has assigned @llogiq.
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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: 7 candidates
  • 7 candidates expanded to 7 candidates
  • Random selection from Jarcho, llogiq, samueltardieu

@llogiq

llogiq commented May 22, 2026

Copy link
Copy Markdown
Contributor

Thanks.

@llogiq llogiq added this pull request to the merge queue May 22, 2026
Merged via the queue into rust-lang:master with commit b29177d May 22, 2026
11 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants