Skip to content

Commit

Permalink
Ignore paths from expansion in unused_qualifications
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexendoo committed Mar 15, 2024
1 parent 3521a2f commit 8ad6af7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion compiler/rustc_resolve/src/late.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4636,7 +4636,9 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
}

fn lint_unused_qualifications(&mut self, path: &[Segment], ns: Namespace, finalize: Finalize) {
if path.iter().any(|seg| seg.ident.span.from_expansion()) {
if finalize.path_span.from_expansion()
|| path.iter().any(|seg| seg.ident.span.from_expansion())
{
return;
}

Expand Down
1 change: 1 addition & 0 deletions tests/ui/lint/lint-qualification.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ fn main() {
foo::bar();
foo::$b(); // issue #96698
$a::bar();
$a::$b();
} }
m!(foo, bar);
}
Expand Down
1 change: 1 addition & 0 deletions tests/ui/lint/lint-qualification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ fn main() {
foo::bar();
foo::$b(); // issue #96698
$a::bar();
$a::$b();
} }
m!(foo, bar);
}
Expand Down

0 comments on commit 8ad6af7

Please sign in to comment.