Ensure all existing doctest code highlights have documentation modifier

This commit is contained in:
Paul Daniel Faria 2020-06-17 09:33:21 -04:00
parent aae26bc5b8
commit a951108173
3 changed files with 22 additions and 21 deletions

View file

@ -477,10 +477,10 @@ fn highlight_element(
// Simple token-based highlighting
COMMENT => {
let comment = element.into_token().and_then(ast::Comment::cast)?;
if comment.kind().doc.is_some() {
Highlight::from(HighlightTag::Comment) | HighlightModifier::Documentation
} else {
HighlightTag::Comment.into()
let h = HighlightTag::Comment;
match comment.kind().doc {
Some(_) => h | HighlightModifier::Documentation,
None => h.into(),
}
}
STRING | RAW_STRING | RAW_BYTE_STRING | BYTE_STRING => HighlightTag::StringLiteral.into(),