aboutsummaryrefslogtreecommitdiff
path: root/crates/assists
diff options
context:
space:
mode:
authorScott McMurray <[email protected]>2021-02-20 22:45:30 +0000
committerScott McMurray <[email protected]>2021-02-20 22:45:30 +0000
commit0fe44d099ad7cf9c8699e41ece424fda84bce999 (patch)
treee58bcb2c866b96c6863cb75b2b06942f1f14aa49 /crates/assists
parent62bc753f8b1957699288ceea90a4096667bf0ebc (diff)
Stop mixing Result and Option with ? in inline_local_variable
Depending on the discussion in RFC#3058 this might not end up being necessary, but I think it's a reasonable change regardless.
Diffstat (limited to 'crates/assists')
-rw-r--r--crates/assists/src/handlers/inline_local_variable.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/assists/src/handlers/inline_local_variable.rs b/crates/assists/src/handlers/inline_local_variable.rs
index 9b228443f..da5522670 100644
--- a/crates/assists/src/handlers/inline_local_variable.rs
+++ b/crates/assists/src/handlers/inline_local_variable.rs
@@ -78,10 +78,10 @@ pub(crate) fn inline_local_variable(acc: &mut Assists, ctx: &AssistContext) -> O
78 usage_node.syntax().parent().and_then(ast::Expr::cast); 78 usage_node.syntax().parent().and_then(ast::Expr::cast);
79 let usage_parent = match usage_parent_option { 79 let usage_parent = match usage_parent_option {
80 Some(u) => u, 80 Some(u) => u,
81 None => return Ok(false), 81 None => return Some(false),
82 }; 82 };
83 83
84 Ok(!matches!( 84 Some(!matches!(
85 (&initializer_expr, usage_parent), 85 (&initializer_expr, usage_parent),
86 (ast::Expr::CallExpr(_), _) 86 (ast::Expr::CallExpr(_), _)
87 | (ast::Expr::IndexExpr(_), _) 87 | (ast::Expr::IndexExpr(_), _)
@@ -107,10 +107,10 @@ pub(crate) fn inline_local_variable(acc: &mut Assists, ctx: &AssistContext) -> O
107 | (_, ast::Expr::MatchExpr(_)) 107 | (_, ast::Expr::MatchExpr(_))
108 )) 108 ))
109 }) 109 })
110 .collect::<Result<_, _>>() 110 .collect::<Option<_>>()
111 .map(|b| (file_id, b)) 111 .map(|b| (file_id, b))
112 }) 112 })
113 .collect::<Result<FxHashMap<_, Vec<_>>, _>>()?; 113 .collect::<Option<FxHashMap<_, Vec<_>>>>()?;
114 114
115 let init_str = initializer_expr.syntax().text().to_string(); 115 let init_str = initializer_expr.syntax().text().to_string();
116 let init_in_paren = format!("({})", &init_str); 116 let init_in_paren = format!("({})", &init_str);