diff options
Diffstat (limited to 'crates/ra_syntax/src/ast/traits.rs')
-rw-r--r-- | crates/ra_syntax/src/ast/traits.rs | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/crates/ra_syntax/src/ast/traits.rs b/crates/ra_syntax/src/ast/traits.rs index 870e83804..f6c786e44 100644 --- a/crates/ra_syntax/src/ast/traits.rs +++ b/crates/ra_syntax/src/ast/traits.rs | |||
@@ -5,69 +5,69 @@ | |||
5 | use itertools::Itertools; | 5 | use itertools::Itertools; |
6 | 6 | ||
7 | use crate::{ | 7 | use crate::{ |
8 | ast::{self, child_opt, children, support, AstChildren, AstNode, AstToken}, | 8 | ast::{self, support, AstChildren, AstNode, AstToken}, |
9 | syntax_node::SyntaxElementChildren, | 9 | syntax_node::SyntaxElementChildren, |
10 | }; | 10 | }; |
11 | 11 | ||
12 | pub trait TypeAscriptionOwner: AstNode { | 12 | pub trait TypeAscriptionOwner: AstNode { |
13 | fn ascribed_type(&self) -> Option<ast::TypeRef> { | 13 | fn ascribed_type(&self) -> Option<ast::TypeRef> { |
14 | child_opt(self) | 14 | support::child(self.syntax()) |
15 | } | 15 | } |
16 | } | 16 | } |
17 | 17 | ||
18 | pub trait NameOwner: AstNode { | 18 | pub trait NameOwner: AstNode { |
19 | fn name(&self) -> Option<ast::Name> { | 19 | fn name(&self) -> Option<ast::Name> { |
20 | child_opt(self) | 20 | support::child(self.syntax()) |
21 | } | 21 | } |
22 | } | 22 | } |
23 | 23 | ||
24 | pub trait VisibilityOwner: AstNode { | 24 | pub trait VisibilityOwner: AstNode { |
25 | fn visibility(&self) -> Option<ast::Visibility> { | 25 | fn visibility(&self) -> Option<ast::Visibility> { |
26 | child_opt(self) | 26 | support::child(self.syntax()) |
27 | } | 27 | } |
28 | } | 28 | } |
29 | 29 | ||
30 | pub trait LoopBodyOwner: AstNode { | 30 | pub trait LoopBodyOwner: AstNode { |
31 | fn loop_body(&self) -> Option<ast::BlockExpr> { | 31 | fn loop_body(&self) -> Option<ast::BlockExpr> { |
32 | child_opt(self) | 32 | support::child(self.syntax()) |
33 | } | 33 | } |
34 | 34 | ||
35 | fn label(&self) -> Option<ast::Label> { | 35 | fn label(&self) -> Option<ast::Label> { |
36 | child_opt(self) | 36 | support::child(self.syntax()) |
37 | } | 37 | } |
38 | } | 38 | } |
39 | 39 | ||
40 | pub trait ArgListOwner: AstNode { | 40 | pub trait ArgListOwner: AstNode { |
41 | fn arg_list(&self) -> Option<ast::ArgList> { | 41 | fn arg_list(&self) -> Option<ast::ArgList> { |
42 | child_opt(self) | 42 | support::child(self.syntax()) |
43 | } | 43 | } |
44 | } | 44 | } |
45 | 45 | ||
46 | pub trait FnDefOwner: AstNode { | 46 | pub trait FnDefOwner: AstNode { |
47 | fn functions(&self) -> AstChildren<ast::FnDef> { | 47 | fn functions(&self) -> AstChildren<ast::FnDef> { |
48 | children(self) | 48 | support::children(self.syntax()) |
49 | } | 49 | } |
50 | } | 50 | } |
51 | 51 | ||
52 | pub trait ModuleItemOwner: AstNode { | 52 | pub trait ModuleItemOwner: AstNode { |
53 | fn items(&self) -> AstChildren<ast::ModuleItem> { | 53 | fn items(&self) -> AstChildren<ast::ModuleItem> { |
54 | children(self) | 54 | support::children(self.syntax()) |
55 | } | 55 | } |
56 | } | 56 | } |
57 | 57 | ||
58 | pub trait TypeParamsOwner: AstNode { | 58 | pub trait TypeParamsOwner: AstNode { |
59 | fn type_param_list(&self) -> Option<ast::TypeParamList> { | 59 | fn type_param_list(&self) -> Option<ast::TypeParamList> { |
60 | child_opt(self) | 60 | support::child(self.syntax()) |
61 | } | 61 | } |
62 | 62 | ||
63 | fn where_clause(&self) -> Option<ast::WhereClause> { | 63 | fn where_clause(&self) -> Option<ast::WhereClause> { |
64 | child_opt(self) | 64 | support::child(self.syntax()) |
65 | } | 65 | } |
66 | } | 66 | } |
67 | 67 | ||
68 | pub trait TypeBoundsOwner: AstNode { | 68 | pub trait TypeBoundsOwner: AstNode { |
69 | fn type_bound_list(&self) -> Option<ast::TypeBoundList> { | 69 | fn type_bound_list(&self) -> Option<ast::TypeBoundList> { |
70 | child_opt(self) | 70 | support::child(self.syntax()) |
71 | } | 71 | } |
72 | 72 | ||
73 | fn colon(&self) -> Option<ast::Colon> { | 73 | fn colon(&self) -> Option<ast::Colon> { |
@@ -77,7 +77,7 @@ pub trait TypeBoundsOwner: AstNode { | |||
77 | 77 | ||
78 | pub trait AttrsOwner: AstNode { | 78 | pub trait AttrsOwner: AstNode { |
79 | fn attrs(&self) -> AstChildren<ast::Attr> { | 79 | fn attrs(&self) -> AstChildren<ast::Attr> { |
80 | children(self) | 80 | support::children(self.syntax()) |
81 | } | 81 | } |
82 | fn has_atom_attr(&self, atom: &str) -> bool { | 82 | fn has_atom_attr(&self, atom: &str) -> bool { |
83 | self.attrs().filter_map(|x| x.as_simple_atom()).any(|x| x == atom) | 83 | self.attrs().filter_map(|x| x.as_simple_atom()).any(|x| x == atom) |