diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-02-21 00:18:49 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-02-21 00:18:49 +0000 |
commit | 238f3a51733afc564215d14d3366d2cbc4b7a64a (patch) | |
tree | e58bcb2c866b96c6863cb75b2b06942f1f14aa49 /crates/assists | |
parent | 62bc753f8b1957699288ceea90a4096667bf0ebc (diff) | |
parent | 0fe44d099ad7cf9c8699e41ece424fda84bce999 (diff) |
Merge #7735
7735: Stop mixing Result and Option with ? in inline_local_variable r=Veykril a=scottmcm
Depending on the discussion in https://github.com/rust-lang/rfcs/pull/3058 this might not end up being necessary, but I think it's a reasonable change regardless.
Co-authored-by: Scott McMurray <[email protected]>
Diffstat (limited to 'crates/assists')
-rw-r--r-- | crates/assists/src/handlers/inline_local_variable.rs | 8 |
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); |