Unify comment terminology with that of rome_formatter (#2979)

This commit is contained in:
Charlie Marsh 2023-02-16 22:02:25 -05:00 committed by GitHub
parent 34664a0ca0
commit 180541a924
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 64 additions and 45 deletions

View file

@ -37,7 +37,7 @@ impl Format<ASTFormatContext<'_>> for LeadingComments<'_> {
fn fmt(&self, f: &mut Formatter<ASTFormatContext<'_>>) -> FormatResult<()> {
for comment in self.comments {
if matches!(comment.relationship, Relationship::Leading) {
if let TriviaKind::StandaloneComment(range) = comment.kind {
if let TriviaKind::OwnLineComment(range) = comment.kind {
write!(f, [hard_line_break()])?;
write!(f, [literal(range)])?;
}
@ -61,7 +61,7 @@ impl Format<ASTFormatContext<'_>> for TrailingComments<'_> {
fn fmt(&self, f: &mut Formatter<ASTFormatContext<'_>>) -> FormatResult<()> {
for comment in self.comments {
if matches!(comment.relationship, Relationship::Trailing) {
if let TriviaKind::StandaloneComment(range) = comment.kind {
if let TriviaKind::OwnLineComment(range) = comment.kind {
write!(f, [hard_line_break()])?;
write!(f, [literal(range)])?;
}