3042: A tiny bit more consistent API r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
bors[bot] 2020-02-06 23:00:07 +00:00 committed by GitHub
commit 5aba5a756a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -101,7 +101,7 @@ pub(crate) fn convert_to_guarded_return(ctx: AssistCtx) -> Option<Assist> {
// If.
let early_expression = &(early_expression.syntax().to_string() + ";");
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)
}
Some((path, bound_ident)) => {

View file

@ -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!(
"fn f() {{ if !{} {{\n {}\n}}\n}}",
condition.syntax().text(),