mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-25 11:17:13 +00:00
fix: make::expr_closure() -> ClosureExpr
Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
This commit is contained in:
parent
92a7890814
commit
728d72fbe1
@ -79,7 +79,7 @@ fn into_closure(param: &Expr) -> Expr {
|
||||
None
|
||||
}
|
||||
})()
|
||||
.unwrap_or_else(|| make::expr_closure(None, param.clone()))
|
||||
.unwrap_or_else(|| make::expr_closure(None, param.clone()).into())
|
||||
}
|
||||
|
||||
// Assist: replace_with_eager_method
|
||||
|
@ -652,7 +652,10 @@ pub fn expr_ref(expr: ast::Expr, exclusive: bool) -> ast::Expr {
|
||||
pub fn expr_reborrow(expr: ast::Expr) -> ast::Expr {
|
||||
expr_from_text(&format!("&mut *{expr}"))
|
||||
}
|
||||
pub fn expr_closure(pats: impl IntoIterator<Item = ast::Param>, expr: ast::Expr) -> ast::Expr {
|
||||
pub fn expr_closure(
|
||||
pats: impl IntoIterator<Item = ast::Param>,
|
||||
expr: ast::Expr,
|
||||
) -> ast::ClosureExpr {
|
||||
let params = pats.into_iter().join(", ");
|
||||
expr_from_text(&format!("|{params}| {expr}"))
|
||||
}
|
||||
|
@ -476,11 +476,7 @@ impl SyntaxFactory {
|
||||
expr: ast::Expr,
|
||||
) -> ast::ClosureExpr {
|
||||
let (args, input) = iterator_input(pats);
|
||||
// FIXME: `make::expr_paren` should return a `ClosureExpr`, not just an `Expr`
|
||||
let ast::Expr::ClosureExpr(ast) = make::expr_closure(args, expr.clone()).clone_for_update()
|
||||
else {
|
||||
unreachable!()
|
||||
};
|
||||
let ast = make::expr_closure(args, expr.clone()).clone_for_update();
|
||||
|
||||
if let Some(mut mapping) = self.mappings() {
|
||||
let mut builder = SyntaxMappingBuilder::new(ast.syntax.clone());
|
||||
|
Loading…
x
Reference in New Issue
Block a user