aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2019-06-09 17:09:19 +0100
committerEdwin Cheng <[email protected]>2019-06-09 17:09:19 +0100
commit4db0f0ccaf6d44be6369b2da3a0cf58db6a7246c (patch)
treeebfab2c57ad7143f4f9b4fb0bdf241cfd44ebd65 /crates/ra_ide_api/src
parente9848b2e6ce96a52252c8797c6f467e8e6e951a4 (diff)
Rename description funcs
Diffstat (limited to 'crates/ra_ide_api/src')
-rw-r--r--crates/ra_ide_api/src/display/description.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/crates/ra_ide_api/src/display/description.rs b/crates/ra_ide_api/src/display/description.rs
index fd0f564de..4f6b0a858 100644
--- a/crates/ra_ide_api/src/display/description.rs
+++ b/crates/ra_ide_api/src/display/description.rs
@@ -14,49 +14,49 @@ impl Description for ast::FnDef {
14 14
15impl Description for ast::StructDef { 15impl Description for ast::StructDef {
16 fn description(&self) -> Option<String> { 16 fn description(&self) -> Option<String> {
17 visit_node(self, "struct ") 17 description_from_node(self, "struct ")
18 } 18 }
19} 19}
20 20
21impl Description for ast::EnumDef { 21impl Description for ast::EnumDef {
22 fn description(&self) -> Option<String> { 22 fn description(&self) -> Option<String> {
23 visit_node(self, "enum ") 23 description_from_node(self, "enum ")
24 } 24 }
25} 25}
26 26
27impl Description for ast::TraitDef { 27impl Description for ast::TraitDef {
28 fn description(&self) -> Option<String> { 28 fn description(&self) -> Option<String> {
29 visit_node(self, "trait ") 29 description_from_node(self, "trait ")
30 } 30 }
31} 31}
32 32
33impl Description for ast::Module { 33impl Description for ast::Module {
34 fn description(&self) -> Option<String> { 34 fn description(&self) -> Option<String> {
35 visit_node(self, "mod ") 35 description_from_node(self, "mod ")
36 } 36 }
37} 37}
38 38
39impl Description for ast::TypeAliasDef { 39impl Description for ast::TypeAliasDef {
40 fn description(&self) -> Option<String> { 40 fn description(&self) -> Option<String> {
41 visit_node(self, "type ") 41 description_from_node(self, "type ")
42 } 42 }
43} 43}
44 44
45impl Description for ast::ConstDef { 45impl Description for ast::ConstDef {
46 fn description(&self) -> Option<String> { 46 fn description(&self) -> Option<String> {
47 visit_ascribed_node(self, "const ") 47 description_from_ascribed_node(self, "const ")
48 } 48 }
49} 49}
50 50
51impl Description for ast::StaticDef { 51impl Description for ast::StaticDef {
52 fn description(&self) -> Option<String> { 52 fn description(&self) -> Option<String> {
53 visit_ascribed_node(self, "static ") 53 description_from_ascribed_node(self, "static ")
54 } 54 }
55} 55}
56 56
57impl Description for ast::NamedFieldDef { 57impl Description for ast::NamedFieldDef {
58 fn description(&self) -> Option<String> { 58 fn description(&self) -> Option<String> {
59 visit_ascribed_node(self, "") 59 description_from_ascribed_node(self, "")
60 } 60 }
61} 61}
62 62
@@ -66,11 +66,11 @@ impl Description for ast::EnumVariant {
66 } 66 }
67} 67}
68 68
69fn visit_ascribed_node<T>(node: &T, prefix: &str) -> Option<String> 69fn description_from_ascribed_node<T>(node: &T, prefix: &str) -> Option<String>
70where 70where
71 T: NameOwner + VisibilityOwner + TypeAscriptionOwner, 71 T: NameOwner + VisibilityOwner + TypeAscriptionOwner,
72{ 72{
73 let mut string = visit_node(node, prefix)?; 73 let mut string = description_from_node(node, prefix)?;
74 74
75 if let Some(type_ref) = node.ascribed_type() { 75 if let Some(type_ref) = node.ascribed_type() {
76 string.push_str(": "); 76 string.push_str(": ");
@@ -80,7 +80,7 @@ where
80 Some(string) 80 Some(string)
81} 81}
82 82
83fn visit_node<T>(node: &T, label: &str) -> Option<String> 83fn description_from_node<T>(node: &T, label: &str) -> Option<String>
84where 84where
85 T: NameOwner + VisibilityOwner, 85 T: NameOwner + VisibilityOwner,
86{ 86{