inline parameters for a function description #6002
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
This commit is contained in:
parent
2e91159ced
commit
e0f0d93eda
1 changed files with 6 additions and 5 deletions
|
|
@ -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<String> = 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(", "));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue