A tiny bit more consistent API
This commit is contained in:
@@ -101,7 +101,7 @@ pub(crate) fn convert_to_guarded_return(ctx: AssistCtx) -> Option<Assist> {
|
|||||||
// If.
|
// If.
|
||||||
let early_expression = &(early_expression.syntax().to_string() + ";");
|
let early_expression = &(early_expression.syntax().to_string() + ";");
|
||||||
let new_expr = if_indent_level
|
let new_expr = if_indent_level
|
||||||
.increase_indent(make::if_expression(&cond_expr, early_expression));
|
.increase_indent(make::if_expression(cond_expr, early_expression));
|
||||||
replace(new_expr.syntax(), &then_block, &parent_block, &if_expr)
|
replace(new_expr.syntax(), &then_block, &parent_block, &if_expr)
|
||||||
}
|
}
|
||||||
Some((path, bound_ident)) => {
|
Some((path, bound_ident)) => {
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ pub fn where_clause(preds: impl IntoIterator<Item = ast::WherePred>) -> ast::Whe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn if_expression(condition: &ast::Expr, statement: &str) -> ast::IfExpr {
|
pub fn if_expression(condition: ast::Expr, statement: &str) -> ast::IfExpr {
|
||||||
ast_from_text(&format!(
|
ast_from_text(&format!(
|
||||||
"fn f() {{ if !{} {{\n {}\n}}\n}}",
|
"fn f() {{ if !{} {{\n {}\n}}\n}}",
|
||||||
condition.syntax().text(),
|
condition.syntax().text(),
|
||||||
|
|||||||
Reference in New Issue
Block a user