aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ast/traits.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src/ast/traits.rs')
-rw-r--r--crates/ra_syntax/src/ast/traits.rs26
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 @@
5use itertools::Itertools; 5use itertools::Itertools;
6 6
7use crate::{ 7use 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
12pub trait TypeAscriptionOwner: AstNode { 12pub 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
18pub trait NameOwner: AstNode { 18pub 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
24pub trait VisibilityOwner: AstNode { 24pub 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
30pub trait LoopBodyOwner: AstNode { 30pub 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
40pub trait ArgListOwner: AstNode { 40pub 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
46pub trait FnDefOwner: AstNode { 46pub 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
52pub trait ModuleItemOwner: AstNode { 52pub 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
58pub trait TypeParamsOwner: AstNode { 58pub 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
68pub trait TypeBoundsOwner: AstNode { 68pub 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
78pub trait AttrsOwner: AstNode { 78pub 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)