1
Fork 0

Use pretty-printer instead of span_to_snippet

This commit is contained in:
Camelid 2021-03-14 14:39:13 -07:00
parent 13076f90d2
commit 8f40e1180f
3 changed files with 6 additions and 7 deletions

View file

@ -597,13 +597,10 @@ impl CheckAttrVisitor<'tcx> {
hir_id,
i_meta.span,
|lint| {
let msg = if let Ok(snippet) =
self.tcx.sess.source_map().span_to_snippet(i_meta.path.span)
{
format!("unknown `doc` attribute `{}`", snippet,)
} else {
String::from("unknown `doc` attribute")
};
let msg = format!(
"unknown `doc` attribute `{}`",
rustc_ast_pretty::pprust::path_to_string(&i_meta.path),
);
lint.build(&msg).emit();
},
);