stylistic improvements

This commit is contained in:
Anton-4 2024-03-13 20:27:23 +01:00
parent 2c5b085ed5
commit 1efd7615f0
No known key found for this signature in database
GPG key ID: 0971D718C0A9B937
6 changed files with 90 additions and 45 deletions

View file

@ -41,8 +41,12 @@ impl<'a> Formattable for Pattern<'a> {
fn is_multiline(&self) -> bool {
// Theory: a pattern should only be multiline when it contains a comment
match self {
Pattern::SpaceBefore(a, spaces) | Pattern::SpaceAfter(a, spaces) => {
debug_assert!(!spaces.is_empty(), "spaces is empty in pattern {:#?}", a);
Pattern::SpaceBefore(pattern, spaces) | Pattern::SpaceAfter(pattern, spaces) => {
debug_assert!(
!spaces.is_empty(),
"spaces is empty in pattern {:#?}",
pattern
);
spaces.iter().any(|s| s.is_comment())
}