Skip to content

Commit 8435e3f

Browse files
committed
internal: make::expr_prefix should return ast::PrefixExpr
1 parent bdb72bd commit 8435e3f

File tree

7 files changed

+8
-8
lines changed

7 files changed

+8
-8
lines changed

src/tools/rust-analyzer/crates/ide-assists/src/handlers/apply_demorgan.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ fn tail_cb_impl(edit: &mut SourceChangeBuilder, e: &ast::Expr) {
252252

253253
/// Add bang and parentheses to the expression.
254254
fn add_bang_paren(expr: ast::Expr) -> ast::Expr {
255-
make::expr_prefix(T![!], make::expr_paren(expr))
255+
make::expr_prefix(T![!], make::expr_paren(expr)).into()
256256
}
257257

258258
#[cfg(test)]

src/tools/rust-analyzer/crates/ide-assists/src/handlers/convert_closure_to_fn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ fn wrap_capture_in_deref_if_needed(
507507
if does_autoderef {
508508
return capture_name;
509509
}
510-
make::expr_prefix(T![*], capture_name)
510+
make::expr_prefix(T![*], capture_name).into()
511511
}
512512

513513
fn capture_as_arg(ctx: &AssistContext<'_>, capture: &ClosureCapture) -> ast::Expr {

src/tools/rust-analyzer/crates/ide-assists/src/handlers/replace_if_let_with_match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ pub(crate) fn replace_match_with_if_let(acc: &mut Assists, ctx: &AssistContext<'
272272
ast::Pat::LiteralPat(p)
273273
if p.literal().is_some_and(|it| it.token().kind() == T![false]) =>
274274
{
275-
make::expr_prefix(T![!], scrutinee)
275+
make::expr_prefix(T![!], scrutinee).into()
276276
}
277277
_ => make::expr_let(if_let_pat, scrutinee).into(),
278278
};

src/tools/rust-analyzer/crates/ide-assists/src/utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ pub(crate) fn vis_offset(node: &SyntaxNode) -> TextSize {
246246
}
247247

248248
pub(crate) fn invert_boolean_expression(expr: ast::Expr) -> ast::Expr {
249-
invert_special_case(&expr).unwrap_or_else(|| make::expr_prefix(T![!], expr))
249+
invert_special_case(&expr).unwrap_or_else(|| make::expr_prefix(T![!], expr).into())
250250
}
251251

252252
fn invert_special_case(expr: &ast::Expr) -> Option<ast::Expr> {
@@ -262,7 +262,7 @@ fn invert_special_case(expr: &ast::Expr) -> Option<ast::Expr> {
262262
T![>] => T![<=],
263263
T![>=] => T![<],
264264
// Parenthesize other expressions before prefixing `!`
265-
_ => return Some(make::expr_prefix(T![!], make::expr_paren(expr.clone()))),
265+
_ => return Some(make::expr_prefix(T![!], make::expr_paren(expr.clone())).into()),
266266
};
267267
ted::replace(op_token, make::token(rev_token));
268268
Some(bin.into())

src/tools/rust-analyzer/crates/ide-assists/src/utils/ref_field_expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl RefData {
121121
/// Derefs `expr` and wraps it in parens if necessary
122122
pub(crate) fn wrap_expr(&self, mut expr: ast::Expr) -> ast::Expr {
123123
if self.needs_deref {
124-
expr = make::expr_prefix(T![*], expr);
124+
expr = make::expr_prefix(T![*], expr).into();
125125
}
126126

127127
if self.needs_parentheses {

src/tools/rust-analyzer/crates/ide-completion/src/completions/postfix.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ fn include_references(initial_element: &ast::Expr) -> (ast::Expr, ast::Expr) {
303303

304304
resulting_element = ast::Expr::from(parent_deref_element);
305305

306-
new_element_opt = make::expr_prefix(syntax::T![*], new_element_opt);
306+
new_element_opt = make::expr_prefix(syntax::T![*], new_element_opt).into();
307307
}
308308

309309
if let Some(first_ref_expr) = resulting_element.syntax().parent().and_then(ast::RefExpr::cast) {

src/tools/rust-analyzer/crates/syntax/src/ast/make.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ pub fn expr_loop(block: ast::BlockExpr) -> ast::Expr {
623623
expr_from_text(&format!("loop {block}"))
624624
}
625625

626-
pub fn expr_prefix(op: SyntaxKind, expr: ast::Expr) -> ast::Expr {
626+
pub fn expr_prefix(op: SyntaxKind, expr: ast::Expr) -> ast::PrefixExpr {
627627
let token = token(op);
628628
expr_from_text(&format!("{token}{expr}"))
629629
}

0 commit comments

Comments
 (0)