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::{
|
use ra_syntax::{
|
||||||
ast::{
|
ast::{
|
||||||
self, ArgListOwner, ArrayExprKind, LiteralKind, LoopBodyOwner, NameOwner,
|
self, ArgListOwner, ArrayExprKind, LiteralKind, LoopBodyOwner, NameOwner,
|
||||||
TryBlockBodyOwner, TypeAscriptionOwner,
|
TypeAscriptionOwner,
|
||||||
},
|
},
|
||||||
AstNode, AstPtr, SyntaxNodePtr,
|
AstNode, AstPtr, SyntaxNodePtr,
|
||||||
};
|
};
|
||||||
|
@ -640,7 +640,7 @@ where
|
||||||
self.alloc_expr(Expr::If { condition, then_branch, else_branch }, syntax_ptr)
|
self.alloc_expr(Expr::If { condition, then_branch, else_branch }, syntax_ptr)
|
||||||
}
|
}
|
||||||
ast::Expr::TryBlockExpr(e) => {
|
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)
|
self.alloc_expr(Expr::TryBlock { body }, syntax_ptr)
|
||||||
}
|
}
|
||||||
ast::Expr::BlockExpr(e) => self.collect_block_opt(e.block()),
|
ast::Expr::BlockExpr(e) => self.collect_block_opt(e.block()),
|
||||||
|
|
|
@ -3134,8 +3134,11 @@ impl AstNode for TryBlockExpr {
|
||||||
&self.syntax
|
&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)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
pub struct TryExpr {
|
pub struct TryExpr {
|
||||||
pub(crate) syntax: SyntaxNode,
|
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 {
|
pub trait ArgListOwner: AstNode {
|
||||||
fn arg_list(&self) -> Option<ast::ArgList> {
|
fn arg_list(&self) -> Option<ast::ArgList> {
|
||||||
child_opt(self)
|
child_opt(self)
|
||||||
|
|
|
@ -426,7 +426,7 @@ Grammar(
|
||||||
traits: ["LoopBodyOwner"],
|
traits: ["LoopBodyOwner"],
|
||||||
),
|
),
|
||||||
"TryBlockExpr": (
|
"TryBlockExpr": (
|
||||||
traits: ["TryBlockBodyOwner"],
|
options: ["Block"],
|
||||||
),
|
),
|
||||||
"ForExpr": (
|
"ForExpr": (
|
||||||
traits: ["LoopBodyOwner"],
|
traits: ["LoopBodyOwner"],
|
||||||
|
|
Loading…
Reference in a new issue