mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-18 17:40:29 +00:00
assists: turn while into loop
This commit is contained in:
parent
726a2aa211
commit
11a56f886b
4 changed files with 220 additions and 0 deletions
|
@ -316,6 +316,11 @@ pub fn expr_if(
|
|||
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_loop(block: ast::BlockExpr) -> ast::Expr {
|
||||
expr_from_text(&format!("loop {}", 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