1
Fork 0

Remove unused Map field from TraitObjectVisitor.

Also reduce visibility.
This commit is contained in:
Nicholas Nethercote 2025-04-02 10:13:05 +11:00
parent 75558b2ffe
commit 7c5f2265e8
2 changed files with 3 additions and 3 deletions

View file

@ -2147,7 +2147,7 @@ impl<'tcx> TyCtxt<'tcx> {
return vec![]; return vec![];
}; };
let mut v = TraitObjectVisitor(vec![], self.hir()); let mut v = TraitObjectVisitor(vec![]);
v.visit_ty_unambig(hir_output); v.visit_ty_unambig(hir_output);
v.0 v.0
} }
@ -2160,7 +2160,7 @@ impl<'tcx> TyCtxt<'tcx> {
scope_def_id: LocalDefId, scope_def_id: LocalDefId,
) -> Option<(Vec<&'tcx hir::Ty<'tcx>>, Span, Option<Span>)> { ) -> Option<(Vec<&'tcx hir::Ty<'tcx>>, Span, Option<Span>)> {
let hir_id = self.local_def_id_to_hir_id(scope_def_id); let hir_id = self.local_def_id_to_hir_id(scope_def_id);
let mut v = TraitObjectVisitor(vec![], self.hir()); let mut v = TraitObjectVisitor(vec![]);
// when the return type is a type alias // when the return type is a type alias
if let Some(hir::FnDecl { output: hir::FnRetTy::Return(hir_output), .. }) = self.hir_fn_decl_by_hir_id(hir_id) if let Some(hir::FnDecl { output: hir::FnRetTy::Return(hir_output), .. }) = self.hir_fn_decl_by_hir_id(hir_id)
&& let hir::TyKind::Path(hir::QPath::Resolved( && let hir::TyKind::Path(hir::QPath::Resolved(

View file

@ -571,7 +571,7 @@ pub fn suggest_constraining_type_params<'a>(
} }
/// Collect al types that have an implicit `'static` obligation that we could suggest `'_` for. /// Collect al types that have an implicit `'static` obligation that we could suggest `'_` for.
pub struct TraitObjectVisitor<'tcx>(pub Vec<&'tcx hir::Ty<'tcx>>, pub crate::hir::map::Map<'tcx>); pub(crate) struct TraitObjectVisitor<'tcx>(pub(crate) Vec<&'tcx hir::Ty<'tcx>>);
impl<'v> hir::intravisit::Visitor<'v> for TraitObjectVisitor<'v> { impl<'v> hir::intravisit::Visitor<'v> for TraitObjectVisitor<'v> {
fn visit_ty(&mut self, ty: &'v hir::Ty<'v, AmbigArg>) { fn visit_ty(&mut self, ty: &'v hir::Ty<'v, AmbigArg>) {