mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
A tiny bit more consistent API
This commit is contained in:
parent
a4431e8302
commit
56e3fbe588
2 changed files with 2 additions and 2 deletions
|
@ -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(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue