Skip to content

Commit e0f0d93

Browse files
committed
inline parameters for a function description #6002
Signed-off-by: Benjamin Coenen <[email protected]>
1 parent 2e91159 commit e0f0d93

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

crates/ide/src/display.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,12 @@ pub(crate) fn function_declaration(node: &ast::Fn) -> String {
4141
format_to!(buf, "{}", type_params);
4242
}
4343
if let Some(param_list) = node.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()));
44+
let params: Vec<String> = param_list
45+
.self_param()
46+
.into_iter()
47+
.map(|self_param| self_param.to_string())
48+
.chain(param_list.params().map(|param| param.to_string()))
49+
.collect();
4950
// Useful to inline parameters
5051
format_to!(buf, "({})", params.join(", "));
5152
}

0 commit comments

Comments
 (0)