diff options
author | Aleksey Kladov <[email protected]> | 2020-05-20 09:26:14 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-05-20 09:26:14 +0100 |
commit | 36a5ca9a843aa807b8152d4c5631be605fc80e80 (patch) | |
tree | 16533dfea4d0a9854362d1165b3308f0c9e81ee0 /crates/ra_assists/src/handlers | |
parent | 45e343a0ef6f4caf078811d0664907610f085d54 (diff) |
Minor
Diffstat (limited to 'crates/ra_assists/src/handlers')
-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; |