aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src/display.rs
diff options
context:
space:
mode:
authorBenjamin Coenen <[email protected]>2020-09-15 16:14:48 +0100
committerBenjamin Coenen <[email protected]>2020-09-15 16:15:33 +0100
commit2e91159cedcf8e2acd9f2f32523cce582a2b89ea (patch)
tree84c9dce351786bb338c5fb7140d9a27eb0d16e1d /crates/ide/src/display.rs
parent7ba578ab1413505e960dda305cc322a29bc00ab3 (diff)
inline parameters for a function description #6002
Signed-off-by: Benjamin Coenen <[email protected]>
Diffstat (limited to 'crates/ide/src/display.rs')
-rw-r--r--crates/ide/src/display.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/crates/ide/src/display.rs b/crates/ide/src/display.rs
index 41b5bdc49..5bb065fc1 100644
--- a/crates/ide/src/display.rs
+++ b/crates/ide/src/display.rs
@@ -41,7 +41,13 @@ 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 format_to!(buf, "{}", param_list); 44 let mut params = match param_list.self_param() {
45 Some(self_param) => vec![self_param.to_string()],
46 None => vec![],
47 };
48 params.extend(param_list.params().map(|param| param.to_string()));
49 // Useful to inline parameters
50 format_to!(buf, "({})", params.join(", "));
45 } 51 }
46 if let Some(ret_type) = node.ret_type() { 52 if let Some(ret_type) = node.ret_type() {
47 if ret_type.ty().is_some() { 53 if ret_type.ty().is_some() {