1
Fork 0

Rollup merge of #122435 - jieyouxu:unused_qualifications_global_paths, r=petrochenkov

Don't trigger `unused_qualifications` on global paths

Fixes #122374.
This commit is contained in:
Matthias Krüger 2024-03-19 18:03:49 +01:00 committed by GitHub
commit 489c2e9918
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 30 additions and 25 deletions

View file

@ -4665,6 +4665,13 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
}
fn lint_unused_qualifications(&mut self, path: &[Segment], ns: Namespace, finalize: Finalize) {
// Don't lint on global paths because the user explicitly wrote out the full path.
if let Some(seg) = path.first()
&& seg.ident.name == kw::PathRoot
{
return;
}
if path.iter().any(|seg| seg.ident.span.from_expansion()) {
return;
}