aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide')
-rw-r--r--crates/ra_ide/src/display/function_signature.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/crates/ra_ide/src/display/function_signature.rs b/crates/ra_ide/src/display/function_signature.rs
index 9572debd8..4f054398a 100644
--- a/crates/ra_ide/src/display/function_signature.rs
+++ b/crates/ra_ide/src/display/function_signature.rs
@@ -187,6 +187,14 @@ impl FunctionSignature {
187 187
188impl From<&'_ ast::FnDef> for FunctionSignature { 188impl From<&'_ ast::FnDef> for FunctionSignature {
189 fn from(node: &ast::FnDef) -> FunctionSignature { 189 fn from(node: &ast::FnDef) -> FunctionSignature {
190 fn strip_leading_underscore(name: String) -> String {
191 if name.starts_with("_") {
192 name.get(1..).unwrap_or_default().to_string()
193 } else {
194 name
195 }
196 }
197
190 fn param_list(node: &ast::FnDef) -> (bool, Vec<String>, Vec<String>) { 198 fn param_list(node: &ast::FnDef) -> (bool, Vec<String>, Vec<String>) {
191 let mut res = vec![]; 199 let mut res = vec![];
192 let mut res_types = vec![]; 200 let mut res_types = vec![];
@@ -230,7 +238,7 @@ impl From<&'_ ast::FnDef> for FunctionSignature {
230 param_list 238 param_list
231 .params() 239 .params()
232 .map(|param| { 240 .map(|param| {
233 Some( 241 Some(strip_leading_underscore(
234 param 242 param
235 .pat()? 243 .pat()?
236 .syntax() 244 .syntax()
@@ -238,7 +246,7 @@ impl From<&'_ ast::FnDef> for FunctionSignature {
238 .find_map(ast::Name::cast)? 246 .find_map(ast::Name::cast)?
239 .text() 247 .text()
240 .to_string(), 248 .to_string(),
241 ) 249 ))
242 }) 250 })
243 .map(|param| param.unwrap_or_default()), 251 .map(|param| param.unwrap_or_default()),
244 ); 252 );