Skip to content

Commit 1adcbf1

Browse files
committed
add CodeBlockAttribute::is_formattable_rust method
A helper method used to determine if the code block contains rust code that should be formatted. This will help when implementing rust code block formatting in markdown files.
1 parent 0d4c4f6 commit 1adcbf1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/comment.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,12 @@ impl CodeBlockAttribute {
430430
}
431431
CodeBlockAttribute::Rust
432432
}
433+
434+
/// Check if the code block was annotated with rust attributes that indicate
435+
/// the code block contains rust code that rustfmt should format.
436+
pub(crate) fn is_formattable_rust(&self) -> bool {
437+
matches!(self, Self::Rust)
438+
}
433439
}
434440

435441
/// Block that is formatted as an item.

0 commit comments

Comments
 (0)