Correctly pluralize message

This commit is contained in:
Jonas Schievink 2020-07-09 15:50:53 +02:00
parent 73327c647d
commit d04f3604d5

View file

@ -208,7 +208,8 @@ pub struct MismatchedArgCount {
impl Diagnostic for MismatchedArgCount {
fn message(&self) -> String {
format!("Expected {} arguments, found {}", self.expected, self.found)
let s = if self.expected == 1 { "" } else { "s" };
format!("Expected {} argument{}, found {}", self.expected, s, self.found)
}
fn source(&self) -> InFile<SyntaxNodePtr> {
InFile { file_id: self.file, value: self.call_expr.clone().into() }