mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-22 11:24:24 +00:00
feat: add expr_for_loop to make in syntax
This commit is contained in:
parent
eea21490e0
commit
61fb16577b
1 changed files with 3 additions and 0 deletions
|
@ -222,6 +222,9 @@ pub fn expr_if(
|
|||
};
|
||||
expr_from_text(&format!("if {} {} {}", condition, then_branch, else_branch))
|
||||
}
|
||||
pub fn expr_for_loop(pat: ast::Pat, expr: ast::Expr, block: ast::BlockExpr) -> ast::Expr {
|
||||
expr_from_text(&format!("for {} in {} {}", pat, expr, block))
|
||||
}
|
||||
pub fn expr_prefix(op: SyntaxKind, expr: ast::Expr) -> ast::Expr {
|
||||
let token = token(op);
|
||||
expr_from_text(&format!("{}{}", token, expr))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue