Skip to content

Commit bdb72bd

Browse files
committed
internal: Generalize make::expr_from_text to types which implement Into<ast::Expr>
This will help with specializing the various `make::expr_*` functions later
1 parent 5afee0d commit bdb72bd

File tree

1 file changed

+1
-1
lines changed
  • src/tools/rust-analyzer/crates/syntax/src/ast

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ pub fn expr_tuple(elements: impl IntoIterator<Item = ast::Expr>) -> ast::Expr {
663663
pub fn expr_assignment(lhs: ast::Expr, rhs: ast::Expr) -> ast::Expr {
664664
expr_from_text(&format!("{lhs} = {rhs}"))
665665
}
666-
fn expr_from_text(text: &str) -> ast::Expr {
666+
fn expr_from_text<E: Into<ast::Expr> + AstNode>(text: &str) -> E {
667667
ast_from_text(&format!("const C: () = {text};"))
668668
}
669669
pub fn expr_let(pattern: ast::Pat, expr: ast::Expr) -> ast::LetExpr {

0 commit comments

Comments
 (0)