mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 05:23:24 +00:00
Merge #1751
1751: remove useless trait r=matklad a=matklad Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
a8397deab9
4 changed files with 8 additions and 11 deletions
|
@ -7,7 +7,7 @@ use ra_arena::{impl_arena_id, map::ArenaMap, Arena, RawId};
|
|||
use ra_syntax::{
|
||||
ast::{
|
||||
self, ArgListOwner, ArrayExprKind, LiteralKind, LoopBodyOwner, NameOwner,
|
||||
TryBlockBodyOwner, TypeAscriptionOwner,
|
||||
TypeAscriptionOwner,
|
||||
},
|
||||
AstNode, AstPtr, SyntaxNodePtr,
|
||||
};
|
||||
|
@ -640,7 +640,7 @@ where
|
|||
self.alloc_expr(Expr::If { condition, then_branch, else_branch }, syntax_ptr)
|
||||
}
|
||||
ast::Expr::TryBlockExpr(e) => {
|
||||
let body = self.collect_block_opt(e.try_body());
|
||||
let body = self.collect_block_opt(e.block());
|
||||
self.alloc_expr(Expr::TryBlock { body }, syntax_ptr)
|
||||
}
|
||||
ast::Expr::BlockExpr(e) => self.collect_block_opt(e.block()),
|
||||
|
|
|
@ -3134,8 +3134,11 @@ impl AstNode for TryBlockExpr {
|
|||
&self.syntax
|
||||
}
|
||||
}
|
||||
impl ast::TryBlockBodyOwner for TryBlockExpr {}
|
||||
impl TryBlockExpr {}
|
||||
impl TryBlockExpr {
|
||||
pub fn block(&self) -> Option<Block> {
|
||||
AstChildren::new(&self.syntax).next()
|
||||
}
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct TryExpr {
|
||||
pub(crate) syntax: SyntaxNode,
|
||||
|
|
|
@ -33,12 +33,6 @@ pub trait LoopBodyOwner: AstNode {
|
|||
}
|
||||
}
|
||||
|
||||
pub trait TryBlockBodyOwner: AstNode {
|
||||
fn try_body(&self) -> Option<ast::Block> {
|
||||
child_opt(self)
|
||||
}
|
||||
}
|
||||
|
||||
pub trait ArgListOwner: AstNode {
|
||||
fn arg_list(&self) -> Option<ast::ArgList> {
|
||||
child_opt(self)
|
||||
|
|
|
@ -426,7 +426,7 @@ Grammar(
|
|||
traits: ["LoopBodyOwner"],
|
||||
),
|
||||
"TryBlockExpr": (
|
||||
traits: ["TryBlockBodyOwner"],
|
||||
options: ["Block"],
|
||||
),
|
||||
"ForExpr": (
|
||||
traits: ["LoopBodyOwner"],
|
||||
|
|
Loading…
Reference in a new issue