Skip to content

Commit 238f3a5

Browse files
bors[bot]scottmcm
andauthored
Merge #7735
7735: Stop mixing Result and Option with ? in inline_local_variable r=Veykril a=scottmcm Depending on the discussion in rust-lang/rfcs#3058 this might not end up being necessary, but I think it's a reasonable change regardless. Co-authored-by: Scott McMurray <[email protected]>
2 parents 62bc753 + 0fe44d0 commit 238f3a5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

crates/assists/src/handlers/inline_local_variable.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ pub(crate) fn inline_local_variable(acc: &mut Assists, ctx: &AssistContext) -> O
7878
usage_node.syntax().parent().and_then(ast::Expr::cast);
7979
let usage_parent = match usage_parent_option {
8080
Some(u) => u,
81-
None => return Ok(false),
81+
None => return Some(false),
8282
};
8383

84-
Ok(!matches!(
84+
Some(!matches!(
8585
(&initializer_expr, usage_parent),
8686
(ast::Expr::CallExpr(_), _)
8787
| (ast::Expr::IndexExpr(_), _)
@@ -107,10 +107,10 @@ pub(crate) fn inline_local_variable(acc: &mut Assists, ctx: &AssistContext) -> O
107107
| (_, ast::Expr::MatchExpr(_))
108108
))
109109
})
110-
.collect::<Result<_, _>>()
110+
.collect::<Option<_>>()
111111
.map(|b| (file_id, b))
112112
})
113-
.collect::<Result<FxHashMap<_, Vec<_>>, _>>()?;
113+
.collect::<Option<FxHashMap<_, Vec<_>>>>()?;
114114

115115
let init_str = initializer_expr.syntax().text().to_string();
116116
let init_in_paren = format!("({})", &init_str);

0 commit comments

Comments
 (0)