mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
wip enum record/tuple generation
This commit is contained in:
parent
65ce87cad8
commit
1cf7af7032
3 changed files with 78 additions and 8 deletions
|
@ -160,6 +160,18 @@ pub enum ElseBranch {
|
|||
IfExpr(ast::IfExpr),
|
||||
}
|
||||
|
||||
impl From<ast::BlockExpr> for ElseBranch {
|
||||
fn from(block_expr: ast::BlockExpr) -> Self {
|
||||
Self::Block(block_expr)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ast::IfExpr> for ElseBranch {
|
||||
fn from(if_expr: ast::IfExpr) -> Self {
|
||||
Self::IfExpr(if_expr)
|
||||
}
|
||||
}
|
||||
|
||||
impl ast::IfExpr {
|
||||
pub fn then_branch(&self) -> Option<ast::BlockExpr> {
|
||||
self.blocks().next()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue