Basic formatting of multi-abilities

This commit is contained in:
Ayaz Hafiz 2022-10-17 10:31:07 -05:00
parent 0642952d05
commit 1053c11907
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
2 changed files with 44 additions and 4 deletions

View file

@ -546,8 +546,8 @@ impl<'a> Formattable for Tag<'a> {
impl<'a> Formattable for HasClause<'a> {
fn is_multiline(&self) -> bool {
// TODO(abilities)
self.abilities[0].is_multiline()
// No, always put abilities in a "has" clause on one line
false
}
fn format_with_options<'buf>(
@ -561,8 +561,15 @@ impl<'a> Formattable for HasClause<'a> {
buf.spaces(1);
buf.push_str("has");
buf.spaces(1);
// TODO(abilities)
self.abilities[0].format_with_options(buf, parens, newlines, indent);
for (i, ab) in self.abilities.iter().enumerate() {
if i > 0 {
buf.spaces(1);
buf.push('&');
buf.spaces(1);
}
ab.format_with_options(buf, parens, newlines, indent);
}
}
}