forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#94951 - est31:irrefutable_let_chain_pattern…
…s, r=estebank Extend the irrefutable_let_patterns lint to let chains Implements the suggestion from rust-lang#94927 (comment) We only look for complete suffixes or prefixes of irrefutable let patterns, so that an irrefutable let pattern in a chain surrounded by refutable ones is not linted, as it is an useful pattern that has no low-cost replacement (unlike suffixes or prefixes which can just be copied outside of the `if`: either into the `if`'s block, or the block surrounding the `if`). If all patterns in a let chain are irrefutable, we lint as well. Depends on rust-lang#94958 ~~so I included it into the PR for now~~ *which has been merged since*. r? `@estebank` cc `@joshtriplett` `@c410-f3r`
- Loading branch information
Showing
5 changed files
with
339 additions
and
45 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
1 change: 1 addition & 0 deletions
1
src/test/ui/rfc-2497-if-let-chains/ast-lowering-does-not-wrap-let-chains.rs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
// run-pass | ||
|
||
#![feature(let_chains)] | ||
#![allow(irrefutable_let_patterns)] | ||
|
||
fn main() { | ||
let first = Some(1); | ||
|
Oops, something went wrong.