Closed
Description
The following triggers irrefutable_let_patterns
:
fn expensive() -> u32 {
0
}
fn option(x: u32) -> Option<u32> {
Some(x)
}
fn f(x: bool) {
if x {
// something
} else if let foo = expensive()
&& let Some(bar) = option(foo)
{
// use `foo` and `bar`
} else {
// something
}
}
Though let foo = expensive()
is irrefutable, it would add an extra layer of nesting to move it into a regular let
statement. e.g.
if x {
// something
} else {
let foo = expensive()
if let Some(bar) = option(foo) {
// use `foo` and `bar`
} else {
// something
}
}
Metadata
Metadata
Assignees
Labels
Area: Lints (warnings about flaws in source code) such as unused_mut.Category: This is a bug.`#![feature(let_chains)]`Lint: irrefutable_let_patternsRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the language team, which will review and decide on the PR/issue.