Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit c7a3f34

Browse files
committed
Auto merge of rust-lang#13940 - nlydv:unwrap-panic, r=lnicola
Fix panicking Option unwraping in match arm analysis Hi, first PR here! I've noticed my IDE sometimes briefly becoming pretty slow to respond while writing Rust. When checking the logs I found reams of this same error repeating itself. ``` thread 'Worker' panicked at 'called `Option::unwrap()` on a `None` value' crates/ide-assists/src/handlers/convert_match_to_let_else.rs:90:46 ``` RA seemed to have been panicking on virtually every keystroke I made whenever I was part way through writing/refactoring a match statement of relevance to this assist. The fix in this PR should be self-explanatory.
2 parents fb39efe + 9721505 commit c7a3f34

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

crates/ide-assists/src/handlers/convert_match_to_let_else.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ fn find_arms(
8787
let mut extracting = None;
8888
let mut diverging = None;
8989
for arm in arms {
90-
if ctx.sema.type_of_expr(&arm.expr().unwrap()).unwrap().original().is_never() {
90+
if ctx.sema.type_of_expr(&arm.expr()?)?.original().is_never() {
9191
diverging = Some(arm);
9292
} else {
9393
extracting = Some(arm);

0 commit comments

Comments
 (0)