From f9ed012000e6b97878abe6ad41c7842be23590c3 Mon Sep 17 00:00:00 2001 From: Noah Lev Date: Fri, 3 Dec 2021 13:36:06 -0800 Subject: [PATCH] Clean up definition of `clean_ty_generics` a bit --- src/librustdoc/clean/mod.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 110ee839f7c..116364ea310 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -31,6 +31,7 @@ use rustc_typeck::hir_ty_to_ty; use std::assert_matches::assert_matches; use std::collections::hash_map::Entry; +use std::collections::BTreeMap; use std::default::Default; use std::hash::Hash; use std::{mem, vec}; @@ -527,9 +528,6 @@ fn clean_ty_generics( gens: &ty::Generics, preds: ty::GenericPredicates<'tcx>, ) -> Generics { - use self::WherePredicate as WP; - use std::collections::BTreeMap; - // Don't populate `cx.impl_trait_bounds` before `clean`ning `where` clauses, // since `Clean for ty::Predicate` would consume them. let mut impl_trait = BTreeMap::>::default(); @@ -650,7 +648,7 @@ fn clean_ty_generics( // handled in cleaning associated types let mut sized_params = FxHashSet::default(); where_predicates.retain(|pred| match *pred { - WP::BoundPredicate { ty: Generic(ref g), ref bounds, .. } => { + WherePredicate::BoundPredicate { ty: Generic(ref g), ref bounds, .. } => { if bounds.iter().any(|b| b.is_sized_bound(cx)) { sized_params.insert(*g); false @@ -667,7 +665,7 @@ fn clean_ty_generics( if matches!(tp.kind, types::GenericParamDefKind::Type { .. }) && !sized_params.contains(&tp.name) { - where_predicates.push(WP::BoundPredicate { + where_predicates.push(WherePredicate::BoundPredicate { ty: Type::Generic(tp.name), bounds: vec![GenericBound::maybe_sized(cx)], bound_params: Vec::new(),