mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-12 05:08:52 +00:00
internal: Generalize make::expr_from_text
to types which implement Into<ast::Expr>
This will help with specializing the various `make::expr_*` functions later
This commit is contained in:
parent
bfb81275fb
commit
159731022f
1 changed files with 1 additions and 1 deletions
|
@ -663,7 +663,7 @@ pub fn expr_tuple(elements: impl IntoIterator<Item = ast::Expr>) -> ast::Expr {
|
|||
pub fn expr_assignment(lhs: ast::Expr, rhs: ast::Expr) -> ast::Expr {
|
||||
expr_from_text(&format!("{lhs} = {rhs}"))
|
||||
}
|
||||
fn expr_from_text(text: &str) -> ast::Expr {
|
||||
fn expr_from_text<E: Into<ast::Expr> + AstNode>(text: &str) -> E {
|
||||
ast_from_text(&format!("const C: () = {text};"))
|
||||
}
|
||||
pub fn expr_let(pattern: ast::Pat, expr: ast::Expr) -> ast::LetExpr {
|
||||
|
|
Loading…
Reference in a new issue