diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_assists/src/handlers/change_return_type_to_result.rs | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/crates/ra_assists/src/handlers/change_return_type_to_result.rs b/crates/ra_assists/src/handlers/change_return_type_to_result.rs index 5c907097e..c2ea87dd7 100644 --- a/crates/ra_assists/src/handlers/change_return_type_to_result.rs +++ b/crates/ra_assists/src/handlers/change_return_type_to_result.rs | |||
@@ -19,8 +19,7 @@ use crate::{AssistContext, AssistId, Assists}; | |||
19 | // fn foo() -> Result<i32, > { Ok(42i32) } | 19 | // fn foo() -> Result<i32, > { Ok(42i32) } |
20 | // ``` | 20 | // ``` |
21 | pub(crate) fn change_return_type_to_result(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { | 21 | pub(crate) fn change_return_type_to_result(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { |
22 | let fn_def = ctx.find_node_at_offset::<ast::FnDef>(); | 22 | let fn_def = ctx.find_node_at_offset::<ast::FnDef>()?; |
23 | let fn_def = &mut fn_def?; | ||
24 | let ret_type = &fn_def.ret_type()?.type_ref()?; | 23 | let ret_type = &fn_def.ret_type()?.type_ref()?; |
25 | if ret_type.syntax().text().to_string().starts_with("Result<") { | 24 | if ret_type.syntax().text().to_string().starts_with("Result<") { |
26 | return None; | 25 | return None; |