Skip to content

Commit

Permalink
Merge #3042
Browse files Browse the repository at this point in the history
3042: A tiny bit more consistent API r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
  • Loading branch information
bors[bot] and matklad committed Feb 6, 2020
2 parents a4431e8 + 56e3fbe commit 5aba5a7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crates/ra_assists/src/assists/early_return.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)) => {
Expand Down
2 changes: 1 addition & 1 deletion crates/ra_syntax/src/ast/make.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit 5aba5a7

Please sign in to comment.