mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Auto merge of #153838 - oli-obk:use-tree-span, r=davidtwco
Use fine grained component-wise span tracking in use trees This often produces nicer spans and even doesn't need a Span field anymore (not that I expect the unused field to affect any perf, but still neat).
This commit is contained in:
@@ -210,7 +210,7 @@ fn track_uses(
|
||||
if !macros.contains(&name) {
|
||||
single_use_usages.push(SingleUse {
|
||||
name,
|
||||
span: tree.0.span,
|
||||
span: tree.0.span(),
|
||||
item_id: item.id,
|
||||
can_suggest: false,
|
||||
});
|
||||
|
||||
@@ -48,7 +48,7 @@ fn check_use_tree(use_tree: &UseTree, cx: &EarlyContext<'_>, span: Span) {
|
||||
.ident;
|
||||
unsafe_to_safe_check(old_name, new_name, cx, span);
|
||||
},
|
||||
UseTreeKind::Simple(None) | UseTreeKind::Glob => {},
|
||||
UseTreeKind::Simple(None) | UseTreeKind::Glob(_) => {},
|
||||
UseTreeKind::Nested { ref items, .. } => {
|
||||
for (use_tree, _) in items {
|
||||
check_use_tree(use_tree, cx, span);
|
||||
|
||||
@@ -812,7 +812,7 @@ pub fn eq_const_item_rhs(l: &ConstItemRhsKind, r: &ConstItemRhsKind) -> bool {
|
||||
pub fn eq_use_tree_kind(l: &UseTreeKind, r: &UseTreeKind) -> bool {
|
||||
use UseTreeKind::*;
|
||||
match (l, r) {
|
||||
(Glob, Glob) => true,
|
||||
(Glob(_), Glob(_)) => true,
|
||||
(Simple(l), Simple(r)) => both(l.as_ref(), r.as_ref(), |l, r| eq_id(*l, *r)),
|
||||
(Nested { items: l, .. }, Nested { items: r, .. }) => over(l, r, |(l, _), (r, _)| eq_use_tree(l, r)),
|
||||
_ => false,
|
||||
|
||||
Reference in New Issue
Block a user