mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 00:01:16 +00:00
Refactor is_multiline for collections
This commit is contained in:
parent
545882f210
commit
3b1ca5c310
1 changed files with 6 additions and 1 deletions
|
@ -88,7 +88,12 @@ where
|
||||||
T: Formattable,
|
T: Formattable,
|
||||||
{
|
{
|
||||||
fn is_multiline(&self) -> bool {
|
fn is_multiline(&self) -> bool {
|
||||||
self.items.iter().any(|item| item.is_multiline()) || !self.final_comments().is_empty()
|
// if there are any comments, they must go on their own line
|
||||||
|
// because otherwise they'd comment out the closing delimiter
|
||||||
|
!self.final_comments().is_empty() ||
|
||||||
|
// if any of the items in the collection are multiline,
|
||||||
|
// then the whole collection must be multiline
|
||||||
|
self.items.iter().any(Formattable::is_multiline)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue