aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r--crates/ra_ide/src/display/function_signature.rs16
1 files changed, 5 insertions, 11 deletions
diff --git a/crates/ra_ide/src/display/function_signature.rs b/crates/ra_ide/src/display/function_signature.rs
index 4f054398a..fabc78f14 100644
--- a/crates/ra_ide/src/display/function_signature.rs
+++ b/crates/ra_ide/src/display/function_signature.rs
@@ -187,14 +187,6 @@ 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
198 fn param_list(node: &ast::FnDef) -> (bool, Vec<String>, Vec<String>) { 190 fn param_list(node: &ast::FnDef) -> (bool, Vec<String>, Vec<String>) {
199 let mut res = vec![]; 191 let mut res = vec![];
200 let mut res_types = vec![]; 192 let mut res_types = vec![];
@@ -238,15 +230,17 @@ impl From<&'_ ast::FnDef> for FunctionSignature {
238 param_list 230 param_list
239 .params() 231 .params()
240 .map(|param| { 232 .map(|param| {
241 Some(strip_leading_underscore( 233 Some(
242 param 234 param
243 .pat()? 235 .pat()?
244 .syntax() 236 .syntax()
245 .descendants() 237 .descendants()
246 .find_map(ast::Name::cast)? 238 .find_map(ast::Name::cast)?
247 .text() 239 .text()
248 .to_string(), 240 .to_string()
249 )) 241 .trim_start_matches('_')
242 .into(),
243 )
250 }) 244 })
251 .map(|param| param.unwrap_or_default()), 245 .map(|param| param.unwrap_or_default()),
252 ); 246 );