aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api')
-rw-r--r--crates/ra_ide_api/src/display/function_signature.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/crates/ra_ide_api/src/display/function_signature.rs b/crates/ra_ide_api/src/display/function_signature.rs
index 736b5d3db..e21f8378d 100644
--- a/crates/ra_ide_api/src/display/function_signature.rs
+++ b/crates/ra_ide_api/src/display/function_signature.rs
@@ -13,16 +13,16 @@ use crate::{
13}; 13};
14 14
15#[derive(Debug)] 15#[derive(Debug)]
16pub enum SigKind { 16pub enum CallableKind {
17 Function, 17 Function,
18 Struct, 18 StructConstructor,
19 EnumVariant, 19 VariantConstructor,
20} 20}
21 21
22/// Contains information about a function signature 22/// Contains information about a function signature
23#[derive(Debug)] 23#[derive(Debug)]
24pub struct FunctionSignature { 24pub struct FunctionSignature {
25 pub kind: SigKind, 25 pub kind: CallableKind,
26 /// Optional visibility 26 /// Optional visibility
27 pub visibility: Option<String>, 27 pub visibility: Option<String>,
28 /// Name of the function 28 /// Name of the function
@@ -69,7 +69,7 @@ impl FunctionSignature {
69 69
70 Some( 70 Some(
71 FunctionSignature { 71 FunctionSignature {
72 kind: SigKind::Struct, 72 kind: CallableKind::StructConstructor,
73 visibility: node.visibility().map(|n| n.syntax().text().to_string()), 73 visibility: node.visibility().map(|n| n.syntax().text().to_string()),
74 name: node.name().map(|n| n.text().to_string()), 74 name: node.name().map(|n| n.text().to_string()),
75 ret_type: node.name().map(|n| n.text().to_string()), 75 ret_type: node.name().map(|n| n.text().to_string()),
@@ -111,7 +111,7 @@ impl FunctionSignature {
111 111
112 Some( 112 Some(
113 FunctionSignature { 113 FunctionSignature {
114 kind: SigKind::EnumVariant, 114 kind: CallableKind::VariantConstructor,
115 visibility: None, 115 visibility: None,
116 name: Some(name), 116 name: Some(name),
117 ret_type: None, 117 ret_type: None,
@@ -140,7 +140,7 @@ impl From<&'_ ast::FnDef> for FunctionSignature {
140 } 140 }
141 141
142 FunctionSignature { 142 FunctionSignature {
143 kind: SigKind::Function, 143 kind: CallableKind::Function,
144 visibility: node.visibility().map(|n| n.syntax().text().to_string()), 144 visibility: node.visibility().map(|n| n.syntax().text().to_string()),
145 name: node.name().map(|n| n.text().to_string()), 145 name: node.name().map(|n| n.text().to_string()),
146 ret_type: node 146 ret_type: node
@@ -164,9 +164,9 @@ impl Display for FunctionSignature {
164 164
165 if let Some(name) = &self.name { 165 if let Some(name) = &self.name {
166 match self.kind { 166 match self.kind {
167 SigKind::Function => write!(f, "fn {}", name)?, 167 CallableKind::Function => write!(f, "fn {}", name)?,
168 SigKind::Struct => write!(f, "struct {}", name)?, 168 CallableKind::StructConstructor => write!(f, "struct {}", name)?,
169 SigKind::EnumVariant => write!(f, "{}", name)?, 169 CallableKind::VariantConstructor => write!(f, "{}", name)?,
170 } 170 }
171 } 171 }
172 172