mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-02-14 04:58:29 +00:00
Auto merge of #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.
This commit is contained in:
commit
c7a3f34ad8
1 changed files with 1 additions and 1 deletions
|
@ -87,7 +87,7 @@ fn find_arms(
|
|||
let mut extracting = None;
|
||||
let mut diverging = None;
|
||||
for arm in arms {
|
||||
if ctx.sema.type_of_expr(&arm.expr().unwrap()).unwrap().original().is_never() {
|
||||
if ctx.sema.type_of_expr(&arm.expr()?)?.original().is_never() {
|
||||
diverging = Some(arm);
|
||||
} else {
|
||||
extracting = Some(arm);
|
||||
|
|
Loading…
Add table
Reference in a new issue