Improve function signatures in aqua command (#88)

This commit is contained in:
folex
2021-05-21 20:55:23 +03:00
committed by GitHub
parent c62a278897
commit 557419fd51
5 changed files with 25 additions and 13 deletions

View File

@ -56,12 +56,12 @@ impl fmt::Display for FunctionSignature {
_ => unimplemented!("more than 1 output type is unsupported"),
};
if self.arguments.is_empty() {
writeln!(f, "{}: -> {}", self.name, output)
} else {
let args = self.arguments.iter().map(|(_, ty)| ty).format(",");
writeln!(f, "{}: {} -> {}", self.name, args, output)
}
let args = self
.arguments
.iter()
.map(|(name, ty)| format!("{}: {}", name, ty))
.format(", ");
writeln!(f, "{}({}) -> {}", self.name, args, output)
}
}