Parse extended_key_value_attributes

This commit is contained in:
Lukas Wirth 2021-03-18 22:25:10 +01:00
parent 816bc73895
commit 4771a56791
7 changed files with 32 additions and 41 deletions

View file

@ -277,9 +277,9 @@ pub(super) fn doc_comment(hl: &mut Highlights, sema: &Semantics<RootDatabase>, n
}
fn find_doc_string_in_attr(attr: &hir::Attr, it: &ast::Attr) -> Option<ast::String> {
match it.literal() {
match it.expr() {
// #[doc = lit]
Some(lit) => match lit.kind() {
Some(ast::Expr::Literal(lit)) => match lit.kind() {
ast::LiteralKind::String(it) => Some(it),
_ => None,
},
@ -297,6 +297,7 @@ fn find_doc_string_in_attr(attr: &hir::Attr, it: &ast::Attr) -> Option<ast::Stri
string.text().get(1..string.text().len() - 1).map_or(false, |it| it == text)
})
}
_ => return None,
}
}