Shorten Span of unused macro lints
The span has been recuded to the actual ident, instead of linting the *whole* macro.
This commit is contained in:
parent
9dbbbb12c0
commit
9f6ca7482c
7 changed files with 41 additions and 62 deletions
|
@ -1194,15 +1194,9 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
|
|||
// Mark the given macro as unused unless its name starts with `_`.
|
||||
// Macro uses will remove items from this set, and the remaining
|
||||
// items will be reported as `unused_macros`.
|
||||
fn insert_unused_macro(
|
||||
&mut self,
|
||||
ident: Ident,
|
||||
def_id: LocalDefId,
|
||||
node_id: NodeId,
|
||||
span: Span,
|
||||
) {
|
||||
fn insert_unused_macro(&mut self, ident: Ident, def_id: LocalDefId, node_id: NodeId) {
|
||||
if !ident.as_str().starts_with('_') {
|
||||
self.r.unused_macros.insert(def_id, (node_id, span));
|
||||
self.r.unused_macros.insert(def_id, (node_id, ident));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1246,7 +1240,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
|
|||
self.r.define(module, ident, MacroNS, (res, vis, span, expansion, IsMacroExport));
|
||||
} else {
|
||||
self.r.check_reserved_macro_name(ident, res);
|
||||
self.insert_unused_macro(ident, def_id, item.id, span);
|
||||
self.insert_unused_macro(ident, def_id, item.id);
|
||||
}
|
||||
self.r.visibilities.insert(def_id, vis);
|
||||
self.r.arenas.alloc_macro_rules_scope(MacroRulesScope::Binding(
|
||||
|
@ -1267,7 +1261,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
|
|||
_ => self.resolve_visibility(&item.vis),
|
||||
};
|
||||
if vis != ty::Visibility::Public {
|
||||
self.insert_unused_macro(ident, def_id, item.id, span);
|
||||
self.insert_unused_macro(ident, def_id, item.id);
|
||||
}
|
||||
self.r.define(module, ident, MacroNS, (res, vis, span, expansion));
|
||||
self.r.visibilities.insert(def_id, vis);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue