diff options
| author | 许杰友 Jieyou Xu (Joe) <jieyouxu@outlook.com> | 2024-03-15 14:59:05 +0000 |
|---|---|---|
| committer | 许杰友 Jieyou Xu (Joe) <jieyouxu@outlook.com> | 2024-03-15 14:59:05 +0000 |
| commit | 85bad8d1bfa54b2ae201fac0b2369eb631beee76 (patch) | |
| tree | 3e9fa9ff0033f4ec8df4b3a2120bcdae26ee3307 /compiler/rustc_resolve | |
| parent | accc516128b21e960b1a7af45393e9acdd184890 (diff) | |
Don't trigger `unused_qualifications` on global paths
# Conflicts: # tests/ui/lint/lint-qualification.stderr
Diffstat (limited to 'compiler/rustc_resolve')
| -rw-r--r-- | compiler/rustc_resolve/src/late.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs index c9b5c659f0f..520f8b82718 100644 --- a/compiler/rustc_resolve/src/late.rs +++ b/compiler/rustc_resolve/src/late.rs @@ -4645,6 +4645,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; } |
