diff options
| author | lcnr <rust@lcnr.de> | 2024-12-02 13:43:16 +0100 | 
|---|---|---|
| committer | lcnr <rust@lcnr.de> | 2024-12-02 13:43:16 +0100 | 
| commit | cfee10ce899b694e2896cd2f578bdda79746d0a6 (patch) | |
| tree | a9695211ee21bb07e15be3a0f231ecd8f79db3c1 /compiler/rustc_lint/src/internal.rs | |
| parent | bd36e69d2533ee750e2d805915b8ca88d2825e0f (diff) | |
| download | rust-cfee10ce899b694e2896cd2f578bdda79746d0a6.tar.gz rust-cfee10ce899b694e2896cd2f578bdda79746d0a6.zip | |
remove outdated comment
Diffstat (limited to 'compiler/rustc_lint/src/internal.rs')
| -rw-r--r-- | compiler/rustc_lint/src/internal.rs | 15 | 
1 files changed, 4 insertions, 11 deletions
| diff --git a/compiler/rustc_lint/src/internal.rs b/compiler/rustc_lint/src/internal.rs index 38c38b59bc5..7c8a65059d1 100644 --- a/compiler/rustc_lint/src/internal.rs +++ b/compiler/rustc_lint/src/internal.rs @@ -242,17 +242,10 @@ fn is_ty_or_ty_ctxt(cx: &LateContext<'_>, path: &Path<'_>) -> Option<String> { } // Only lint on `&Ty` and `&TyCtxt` if it is used outside of a trait. Res::SelfTyAlias { alias_to: did, is_trait_impl: false, .. } => { - if let ty::Adt(adt, args) = cx.tcx.type_of(did).instantiate_identity().kind() { - if let Some(name @ (sym::Ty | sym::TyCtxt)) = cx.tcx.get_diagnostic_name(adt.did()) - { - // NOTE: This path is currently unreachable as `Ty<'tcx>` is - // defined as a type alias meaning that `impl<'tcx> Ty<'tcx>` - // is not actually allowed. - // - // I(@lcnr) still kept this branch in so we don't miss this - // if we ever change it in the future. - return Some(format!("{}<{}>", name, args[0])); - } + if let ty::Adt(adt, args) = cx.tcx.type_of(did).instantiate_identity().kind() + && let Some(name @ (sym::Ty | sym::TyCtxt)) = cx.tcx.get_diagnostic_name(adt.did()) + { + return Some(format!("{}<{}>", name, args[0])); } } _ => (), | 
