Skip to content

Conversation

@yaahc
Copy link
Member

@yaahc yaahc commented Dec 19, 2025

This flag is intended to address a concern @BoxyUwU raised1 about the difficulty of reviewing code containing let_else expressions and how they can easily be confused with if let expressions.

Footnotes

  1. https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/.60deny.28clippy.3A.3Amanual_let_else.29.60.20proliferation/near/564564043

// let-else may be formatted on a single line if they are "short"
// and only contain a single expression
let Some(x) = opt
else {
Copy link
Member

Choose a reason for hiding this comment

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

imo if the else clause is short enough you should still be able to have it on one line like so:

let Some(x) = opt
else { return };

no need to take 4 lines when 2 is good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants