mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 14:21:44 +00:00
Refactor if-let -> match assist to use ast::make
This commit is contained in:
parent
83dc22e1fb
commit
a4c6e8c4e2
4 changed files with 55 additions and 32 deletions
|
@ -7,6 +7,21 @@ use crate::{
|
|||
SyntaxToken, T,
|
||||
};
|
||||
|
||||
impl ast::Expr {
|
||||
pub fn is_block_like(&self) -> bool {
|
||||
match self {
|
||||
ast::Expr::IfExpr(_)
|
||||
| ast::Expr::LoopExpr(_)
|
||||
| ast::Expr::ForExpr(_)
|
||||
| ast::Expr::WhileExpr(_)
|
||||
| ast::Expr::BlockExpr(_)
|
||||
| ast::Expr::MatchExpr(_)
|
||||
| ast::Expr::TryBlockExpr(_) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum ElseBranch {
|
||||
Block(ast::BlockExpr),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue