Unnamed repository; edit this file 'description' to name the repository.
No edit if no body
| -rw-r--r-- | crates/ide/src/inlay_hints/closure_ret.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/crates/ide/src/inlay_hints/closure_ret.rs b/crates/ide/src/inlay_hints/closure_ret.rs index 22b8c72298..ac40a19a40 100644 --- a/crates/ide/src/inlay_hints/closure_ret.rs +++ b/crates/ide/src/inlay_hints/closure_ret.rs @@ -63,7 +63,10 @@ pub(super) fn hints( } else { Some(config.lazy_text_edit(|| { let body = closure.body(); - let body_range = body.expect("Closure must have a body").syntax().text_range(); + let body_range = match body { + Some(body) => body.syntax().text_range(), + None => return TextEdit::builder().finish(), + }; let mut builder = TextEdit::builder(); let insert_pos = param_list.syntax().text_range().end(); |