Use let...else instead of match foo { ... _ => return }; and if let ... else return by estebank · Pull Request #148837 · rust-lang/rust (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation32 Commits3 Checks11 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

@estebank

@rustbot

Some changes occurred in compiler/rustc_codegen_cranelift

cc @bjorn3

Some changes occurred in compiler/rustc_codegen_ssa

cc @WaffleLapkin

HIR ty lowering was modified

cc @fmease

Some changes occurred in compiler/rustc_codegen_gcc

cc @antoyo, @GuillaumeGomez

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@rustbot rustbot added A-attributes

Area: Attributes (`#[…]`, `#![…]`)

A-LLVM

Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.

O-windows

Operating system: Windows

S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

T-compiler

Relevant to the compiler team, which will review and decide on the PR/issue.

T-libs

Relevant to the library team, which will review and decide on the PR/issue.

WG-trait-system-refactor

The Rustc Trait System Refactor Initiative (-Znext-solver)

labels

Nov 11, 2025

@rustbot

r? @wesleywiser

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

This comment has been minimized.

bjorn3

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe skip this for now to avoid conflicts with #148481?

@chenyukang

do we have a style check for this?

@estebank

Kivooeo

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking time on this, looks good on compiler side, would this reasonable to split compiler and library parts? I'm not sure if I privileged enough to review the library part

There is some places that looks better with the if let guard feature to remove nesting

View changes since this review

@bors

This comment was marked as outdated.

@rustbot

This comment has been minimized.

@rustbot

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

Kivooeo

// tidy-alphabetical-start
#![cfg_attr(bootstrap, feature(array_windows))]
#![deny(clippy::manual_let_else)]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's not add this lint anywhere yet, I think CI will never stop complain about it :D

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm finding them instructive :)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, so feel free to «r=me» once CI passed

Zalathar added a commit to Zalathar/rust that referenced this pull request

Dec 10, 2025

@Zalathar

…bilee

Use let...else instead of match foo { ... _ => return }; and if let ... else return in std

Split off rust-lang#148837.

Zalathar added a commit to Zalathar/rust that referenced this pull request

Dec 10, 2025

@Zalathar

…bilee

Use let...else instead of match foo { ... _ => return }; and if let ... else return in std

Split off rust-lang#148837.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request

Dec 10, 2025

@matthiaskrgr

…bilee

Use let...else instead of match foo { ... _ => return }; and if let ... else return in std

Split off rust-lang#148837.

rust-timer added a commit that referenced this pull request

Dec 10, 2025

@rust-timer

Rollup merge of #149795 - estebank:let-else-std, r=workingjubilee

Use let...else instead of match foo { ... _ => return }; and if let ... else return in std

Split off #148837.

github-actions bot pushed a commit to rust-lang/miri that referenced this pull request

Dec 11, 2025

@matthiaskrgr

Use let...else instead of match foo { ... _ => return }; and if let ... else return in std

Split off rust-lang/rust#148837.

@rustbot

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

Kivooeo

@rust-log-analyzer

This comment has been minimized.

@bors

@rustbot

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@estebank

@bors

📌 Commit 97c7742 has been approved by Kivooeo

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

and removed S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

labels

Dec 12, 2025

jhpratt added a commit to jhpratt/rust that referenced this pull request

Dec 13, 2025

@jhpratt

Use let...else instead of match foo { ... _ => return }; and if let ... else return

bors added a commit that referenced this pull request

Dec 13, 2025

@bors

Rollup of 11 pull requests

Successful merges:

r? @ghost @rustbot modify labels: rollup

bors added a commit that referenced this pull request

Dec 13, 2025

@bors

Rollup of 10 pull requests

Successful merges:

r? @ghost @rustbot modify labels: rollup

rust-timer added a commit that referenced this pull request

Dec 13, 2025

@rust-timer

Rollup merge of #148837 - estebank:let-else, r=Kivooeo

Use let...else instead of match foo { ... _ => return }; and if let ... else return

Labels

A-attributes

Area: Attributes (`#[…]`, `#![…]`)

A-LLVM

Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.

O-windows

Operating system: Windows

S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

T-compiler

Relevant to the compiler team, which will review and decide on the PR/issue.

T-libs

Relevant to the library team, which will review and decide on the PR/issue.

WG-trait-system-refactor

The Rustc Trait System Refactor Initiative (-Znext-solver)