From e0f0d93eda8fbcd523187ef29b713acb9a92cb6f Mon Sep 17 00:00:00 2001 From: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com> Date: Tue, 15 Sep 2020 18:04:34 +0200 Subject: inline parameters for a function description #6002 Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com> --- crates/ide/src/display.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'crates/ide/src') 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 { format_to!(buf, "{}", type_params); } if let Some(param_list) = node.param_list() { - let mut params = match param_list.self_param() { - Some(self_param) => vec![self_param.to_string()], - None => vec![], - }; - params.extend(param_list.params().map(|param| param.to_string())); + let params: Vec = param_list + .self_param() + .into_iter() + .map(|self_param| self_param.to_string()) + .chain(param_list.params().map(|param| param.to_string())) + .collect(); // Useful to inline parameters format_to!(buf, "({})", params.join(", ")); } -- cgit v1.2.3