Unnamed repository; edit this file 'description' to name the repository.
remove other unwraps
Milo 2023-09-25
parent f64eecd · commit 85ead6e
-rw-r--r--crates/ide-assists/src/handlers/generate_function.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/crates/ide-assists/src/handlers/generate_function.rs b/crates/ide-assists/src/handlers/generate_function.rs
index 7949e17653..f74fc5df4b 100644
--- a/crates/ide-assists/src/handlers/generate_function.rs
+++ b/crates/ide-assists/src/handlers/generate_function.rs
@@ -404,7 +404,11 @@ impl FunctionBuilder {
leading_ws,
ret_type: fn_def.ret_type(),
// PANIC: we guarantee we always create a function body with a tail expr
- tail_expr: fn_def.body().unwrap().tail_expr().unwrap(),
+ tail_expr: fn_def
+ .body()
+ .expect("generated function should have a body")
+ .tail_expr()
+ .expect("function body should have a tail expression"),
should_focus_return_type: self.should_focus_return_type,
fn_def,
trailing_ws,