store the span of the nested part of the use tree in the ast
This commit is contained in:
parent
2ec337c193
commit
13f76235b3
17 changed files with 45 additions and 36 deletions
|
@ -565,7 +565,7 @@ impl<'a, 'b, 'tcx> BuildReducedGraphVisitor<'a, 'b, 'tcx> {
|
|||
|
||||
self.add_import(prefix, kind, use_tree.span, item, root_span, item.id, vis);
|
||||
}
|
||||
ast::UseTreeKind::Nested(ref items) => {
|
||||
ast::UseTreeKind::Nested { ref items, .. } => {
|
||||
// Ensure there is at most one `self` in the list
|
||||
let self_spans = items
|
||||
.iter()
|
||||
|
|
|
@ -128,7 +128,7 @@ impl<'a, 'b, 'tcx> UnusedImportCheckVisitor<'a, 'b, 'tcx> {
|
|||
self.unused_import(self.base_id).add(id);
|
||||
}
|
||||
}
|
||||
ast::UseTreeKind::Nested(ref items) => self.check_imports_as_underscore(items),
|
||||
ast::UseTreeKind::Nested { ref items, .. } => self.check_imports_as_underscore(items),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ impl<'a, 'b, 'tcx> Visitor<'a> for UnusedImportCheckVisitor<'a, 'b, 'tcx> {
|
|||
return;
|
||||
}
|
||||
|
||||
if let ast::UseTreeKind::Nested(ref items) = use_tree.kind {
|
||||
if let ast::UseTreeKind::Nested { ref items, .. } = use_tree.kind {
|
||||
if items.is_empty() {
|
||||
self.unused_import(self.base_id).add(id);
|
||||
}
|
||||
|
@ -292,7 +292,7 @@ fn calc_unused_spans(
|
|||
UnusedSpanResult::Used
|
||||
}
|
||||
}
|
||||
ast::UseTreeKind::Nested(ref nested) => {
|
||||
ast::UseTreeKind::Nested { items: ref nested, .. } => {
|
||||
if nested.is_empty() {
|
||||
return UnusedSpanResult::Unused { spans: vec![use_tree.span], remove: full_span };
|
||||
}
|
||||
|
|
|
@ -2332,8 +2332,8 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
|||
None => {}
|
||||
}
|
||||
}
|
||||
} else if let UseTreeKind::Nested(use_trees) = &use_tree.kind {
|
||||
for (use_tree, _) in use_trees {
|
||||
} else if let UseTreeKind::Nested { items, .. } = &use_tree.kind {
|
||||
for (use_tree, _) in items {
|
||||
self.future_proof_import(use_tree);
|
||||
}
|
||||
}
|
||||
|
@ -2510,7 +2510,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
|||
ItemKind::Use(ref use_tree) => {
|
||||
let maybe_exported = match use_tree.kind {
|
||||
UseTreeKind::Simple(_) | UseTreeKind::Glob => MaybeExported::Ok(item.id),
|
||||
UseTreeKind::Nested(_) => MaybeExported::NestedUse(&item.vis),
|
||||
UseTreeKind::Nested { .. } => MaybeExported::NestedUse(&item.vis),
|
||||
};
|
||||
self.resolve_doc_links(&item.attrs, maybe_exported);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue