diff options
author | Aleksey Kladov <[email protected]> | 2019-09-02 17:45:41 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-09-02 17:45:41 +0100 |
commit | f377b94628a265cb5335fbe4594a47cc8ddc9e2c (patch) | |
tree | 4bcefaf1d0be98d44eb27c4d2d03fb0da17621ad /crates | |
parent | 4417a97bc519d8cf658dbd2d09e1d34c8b8f1f23 (diff) |
remove useless trait
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_hir/src/expr.rs | 4 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/generated.rs | 7 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/traits.rs | 6 | ||||
-rw-r--r-- | crates/ra_syntax/src/grammar.ron | 2 |
4 files changed, 8 insertions, 11 deletions
diff --git a/crates/ra_hir/src/expr.rs b/crates/ra_hir/src/expr.rs index 7cdc7555c..c7530849b 100644 --- a/crates/ra_hir/src/expr.rs +++ b/crates/ra_hir/src/expr.rs | |||
@@ -7,7 +7,7 @@ use ra_arena::{impl_arena_id, map::ArenaMap, Arena, RawId}; | |||
7 | use ra_syntax::{ | 7 | use ra_syntax::{ |
8 | ast::{ | 8 | ast::{ |
9 | self, ArgListOwner, ArrayExprKind, LiteralKind, LoopBodyOwner, NameOwner, | 9 | self, ArgListOwner, ArrayExprKind, LiteralKind, LoopBodyOwner, NameOwner, |
10 | TryBlockBodyOwner, TypeAscriptionOwner, | 10 | TypeAscriptionOwner, |
11 | }, | 11 | }, |
12 | AstNode, AstPtr, SyntaxNodePtr, | 12 | AstNode, AstPtr, SyntaxNodePtr, |
13 | }; | 13 | }; |
@@ -640,7 +640,7 @@ where | |||
640 | self.alloc_expr(Expr::If { condition, then_branch, else_branch }, syntax_ptr) | 640 | self.alloc_expr(Expr::If { condition, then_branch, else_branch }, syntax_ptr) |
641 | } | 641 | } |
642 | ast::Expr::TryBlockExpr(e) => { | 642 | ast::Expr::TryBlockExpr(e) => { |
643 | let body = self.collect_block_opt(e.try_body()); | 643 | let body = self.collect_block_opt(e.block()); |
644 | self.alloc_expr(Expr::TryBlock { body }, syntax_ptr) | 644 | self.alloc_expr(Expr::TryBlock { body }, syntax_ptr) |
645 | } | 645 | } |
646 | ast::Expr::BlockExpr(e) => self.collect_block_opt(e.block()), | 646 | ast::Expr::BlockExpr(e) => self.collect_block_opt(e.block()), |
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index 90480b6ca..7f91417c5 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs | |||
@@ -3134,8 +3134,11 @@ impl AstNode for TryBlockExpr { | |||
3134 | &self.syntax | 3134 | &self.syntax |
3135 | } | 3135 | } |
3136 | } | 3136 | } |
3137 | impl ast::TryBlockBodyOwner for TryBlockExpr {} | 3137 | impl TryBlockExpr { |
3138 | impl TryBlockExpr {} | 3138 | pub fn block(&self) -> Option<Block> { |
3139 | AstChildren::new(&self.syntax).next() | ||
3140 | } | ||
3141 | } | ||
3139 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3142 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
3140 | pub struct TryExpr { | 3143 | pub struct TryExpr { |
3141 | pub(crate) syntax: SyntaxNode, | 3144 | pub(crate) syntax: SyntaxNode, |
diff --git a/crates/ra_syntax/src/ast/traits.rs b/crates/ra_syntax/src/ast/traits.rs index 1b9a2b20c..20c251fba 100644 --- a/crates/ra_syntax/src/ast/traits.rs +++ b/crates/ra_syntax/src/ast/traits.rs | |||
@@ -33,12 +33,6 @@ pub trait LoopBodyOwner: AstNode { | |||
33 | } | 33 | } |
34 | } | 34 | } |
35 | 35 | ||
36 | pub trait TryBlockBodyOwner: AstNode { | ||
37 | fn try_body(&self) -> Option<ast::Block> { | ||
38 | child_opt(self) | ||
39 | } | ||
40 | } | ||
41 | |||
42 | pub trait ArgListOwner: AstNode { | 36 | pub trait ArgListOwner: AstNode { |
43 | fn arg_list(&self) -> Option<ast::ArgList> { | 37 | fn arg_list(&self) -> Option<ast::ArgList> { |
44 | child_opt(self) | 38 | child_opt(self) |
diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron index 1836862fe..9f17a10ed 100644 --- a/crates/ra_syntax/src/grammar.ron +++ b/crates/ra_syntax/src/grammar.ron | |||
@@ -426,7 +426,7 @@ Grammar( | |||
426 | traits: ["LoopBodyOwner"], | 426 | traits: ["LoopBodyOwner"], |
427 | ), | 427 | ), |
428 | "TryBlockExpr": ( | 428 | "TryBlockExpr": ( |
429 | traits: ["TryBlockBodyOwner"], | 429 | options: ["Block"], |
430 | ), | 430 | ), |
431 | "ForExpr": ( | 431 | "ForExpr": ( |
432 | traits: ["LoopBodyOwner"], | 432 | traits: ["LoopBodyOwner"], |