minor: use push_str instead
This commit is contained in:
parent
6e08590436
commit
b45cf63f06
1 changed files with 5 additions and 12 deletions
|
|
@ -52,32 +52,25 @@ pub(super) fn print_body_hir(db: &dyn DefDatabase, body: &Body, owner: DefWithBo
|
|||
let (mut params, ret_type) = (function_data.params.iter(), &function_data.ret_type);
|
||||
if let Some(self_param) = body.self_param {
|
||||
p.print_binding(self_param);
|
||||
p.buf.push(':');
|
||||
p.buf.push(' ');
|
||||
p.buf.push_str(": ");
|
||||
if let Some(ty) = params.next() {
|
||||
p.print_type_ref(ty);
|
||||
p.buf.push(',');
|
||||
p.buf.push(' ');
|
||||
p.buf.push_str(", ");
|
||||
}
|
||||
}
|
||||
body.params.iter().zip(params).for_each(|(¶m, ty)| {
|
||||
p.print_pat(param);
|
||||
p.buf.push(':');
|
||||
p.buf.push(' ');
|
||||
p.buf.push_str(": ");
|
||||
p.print_type_ref(ty);
|
||||
p.buf.push(',');
|
||||
p.buf.push(' ');
|
||||
p.buf.push_str(", ");
|
||||
});
|
||||
// remove the last ", " in param list
|
||||
if body.params.len() > 0 {
|
||||
p.buf.truncate(p.buf.len() - 2);
|
||||
}
|
||||
p.buf.push(')');
|
||||
p.buf.push(' ');
|
||||
// return type
|
||||
p.buf.push('-');
|
||||
p.buf.push('>');
|
||||
p.buf.push(' ');
|
||||
p.buf.push_str(" -> ");
|
||||
p.print_type_ref(ret_type);
|
||||
p.buf.push(' ');
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue