From efe86a42dc922ca2cb38227f3b0bf6a420d3cfca Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Mon, 7 Dec 2020 19:05:06 +0100 Subject: Remove raw pre and suffixes from string attr literals --- crates/hir_def/src/attr.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'crates') diff --git a/crates/hir_def/src/attr.rs b/crates/hir_def/src/attr.rs index 98293aad3..4e8b908d0 100644 --- a/crates/hir_def/src/attr.rs +++ b/crates/hir_def/src/attr.rs @@ -195,8 +195,11 @@ impl Attr { fn from_src(ast: ast::Attr, hygiene: &Hygiene) -> Option { let path = ModPath::from_src(ast.path()?, hygiene)?; let input = if let Some(lit) = ast.literal() { - // FIXME: escape? raw string? - let value = lit.syntax().first_token()?.text().trim_matches('"').into(); + let value = if let ast::LiteralKind::String(string) = lit.kind() { + string.value()?.into() + } else { + lit.syntax().first_token()?.text().trim_matches('"').into() + }; Some(AttrInput::Literal(value)) } else if let Some(tt) = ast.token_tree() { Some(AttrInput::TokenTree(ast_to_token_tree(&tt)?.0)) -- cgit v1.2.3