Avoid parenthesizing multiline strings in binary expressions (#6973)

This commit is contained in:
Micha Reiser 2023-08-30 16:03:17 +02:00 committed by GitHub
parent e2b2b1759f
commit eb552da8a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 315 additions and 40 deletions

View file

@ -330,6 +330,17 @@ impl<'a> Comments<'a> {
Self::new(map)
}
/// Returns `true` if the given `node` has any comments.
#[inline]
pub(crate) fn has<T>(&self, node: T) -> bool
where
T: Into<AnyNodeRef<'a>>,
{
self.data
.comments
.has(&NodeRefEqualityKey::from_ref(node.into()))
}
/// Returns `true` if the given `node` has any [leading comments](self#leading-comments).
#[inline]
pub(crate) fn has_leading<T>(&self, node: T) -> bool