You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support if let guards in matches!() and assert_matches!() #152313
In my opinion, it shouldn't. At least I couldn't come up with any useful examples. I thought about it when I was writing a blog post about 'if let' guards
Activity
Kivooeo commentedon Feb 12, 2026
In my opinion, it shouldn't. At least I couldn't come up with any useful examples. I thought about it when I was writing a blog post about 'if let' guards
theemathas commentedon Feb 12, 2026
@Kivooeo Here's an artificial example of how it might be useful.
theemathas commentedon Feb 12, 2026
A more complicated example:
theemathas commentedon Feb 12, 2026
Real world code which could benefit from let-chains in assert_matches: https://github.com/rust-lang/rust/pull/152173/changes#diff-ee51fdc73fed0b3d6074a8e236e0482fc7e4893a11dd0f2b8823415ca5ebbd09R28
Rollup merge of rust-lang#153702 - SpriteOvO:guard-matcher, r=davidtwco
Rollup merge of rust-lang#153702 - SpriteOvO:guard-matcher, r=davidtwco
Rollup merge of rust-lang#153702 - SpriteOvO:guard-matcher, r=davidtwco
Rollup merge of #153702 - SpriteOvO:guard-matcher, r=davidtwco