Properly fetch inner and outer docs on hir-level

This commit is contained in:
Lukas Wirth 2020-12-08 23:30:51 +01:00
parent eac77997bf
commit f8823e8cbc
2 changed files with 33 additions and 17 deletions

View file

@ -17,6 +17,14 @@ impl ast::Comment {
CommentKind::from_text(self.text())
}
pub fn is_inner(&self) -> bool {
self.kind().doc == Some(CommentPlacement::Inner)
}
pub fn is_outer(&self) -> bool {
self.kind().doc == Some(CommentPlacement::Outer)
}
pub fn prefix(&self) -> &'static str {
let &(prefix, _kind) = CommentKind::BY_PREFIX
.iter()