Tweak diagnostics
- Tweak lint message - Display multi-segment paths correctly
This commit is contained in:
parent
13884dc2af
commit
13076f90d2
5 changed files with 25 additions and 22 deletions
|
@ -597,11 +597,14 @@ impl CheckAttrVisitor<'tcx> {
|
|||
hir_id,
|
||||
i_meta.span,
|
||||
|lint| {
|
||||
lint.build(&format!(
|
||||
"unknown `doc` attribute `{}`",
|
||||
i_meta.name_or_empty()
|
||||
))
|
||||
.emit();
|
||||
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")
|
||||
};
|
||||
lint.build(&msg).emit();
|
||||
},
|
||||
);
|
||||
is_valid = false;
|
||||
|
@ -613,7 +616,7 @@ impl CheckAttrVisitor<'tcx> {
|
|||
hir_id,
|
||||
meta.span(),
|
||||
|lint| {
|
||||
lint.build(&format!("unknown `doc` attribute")).emit();
|
||||
lint.build(&format!("invalid `doc` attribute")).emit();
|
||||
},
|
||||
);
|
||||
is_valid = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue