aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src
diff options
context:
space:
mode:
authorBenjamin Coenen <[email protected]>2020-09-15 17:04:34 +0100
committerBenjamin Coenen <[email protected]>2020-09-15 17:04:34 +0100
commite0f0d93eda8fbcd523187ef29b713acb9a92cb6f (patch)
treefc12b815e142d9458cfedf40f5bd5f638c712c9b /crates/ide/src
parent2e91159cedcf8e2acd9f2f32523cce582a2b89ea (diff)
inline parameters for a function description #6002
Signed-off-by: Benjamin Coenen <[email protected]>
Diffstat (limited to 'crates/ide/src')
-rw-r--r--crates/ide/src/display.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/crates/ide/src/display.rs b/crates/ide/src/display.rs
index 5bb065fc1..2484dbbf1 100644
--- a/crates/ide/src/display.rs
+++ b/crates/ide/src/display.rs
@@ -41,11 +41,12 @@ pub(crate) fn function_declaration(node: &ast::Fn) -> String {
41 format_to!(buf, "{}", type_params); 41 format_to!(buf, "{}", type_params);
42 } 42 }
43 if let Some(param_list) = node.param_list() { 43 if let Some(param_list) = node.param_list() {
44 let mut params = match param_list.self_param() { 44 let params: Vec<String> = param_list
45 Some(self_param) => vec![self_param.to_string()], 45 .self_param()
46 None => vec![], 46 .into_iter()
47 }; 47 .map(|self_param| self_param.to_string())
48 params.extend(param_list.params().map(|param| param.to_string())); 48 .chain(param_list.params().map(|param| param.to_string()))
49 .collect();
49 // Useful to inline parameters 50 // Useful to inline parameters
50 format_to!(buf, "({})", params.join(", ")); 51 format_to!(buf, "({})", params.join(", "));
51 } 52 }