remove the definition of def_id_no_primitives and change;
 a missing use was modified;
 narrow the Cache accessibility of BadImplStripper;
This commit is contained in:
zredb 2022-01-15 17:00:59 +08:00 committed by Guillaume Gomez
parent be9d6335f7
commit 16679a6161
3 changed files with 3 additions and 15 deletions

View file

@ -1566,23 +1566,11 @@ impl Type {
/// Use this method to get the [DefId] of a [clean] AST node, including [PrimitiveType]s.
///
/// See [`Self::def_id_no_primitives`] for more.
///
/// [clean]: crate::clean
///
crate fn def_id(&self, cache: &Cache) -> Option<DefId> {
self.inner_def_id(Some(cache))
}
/// Use this method to get the [`DefId`] of a [`clean`] AST node.
/// This will return [`None`] when called on a primitive [`clean::Type`].
/// Use [`Self::def_id`] if you want to include primitives.
///
/// [`clean`]: crate::clean
/// [`clean::Type`]: crate::clean::Type
// FIXME: get rid of this function and always use `def_id`
crate fn def_id_no_primitives(&self) -> Option<DefId> {
self.inner_def_id(None)
}
}
/// A primitive (aka, builtin) type.

View file

@ -208,7 +208,7 @@ impl DocVisitor for ItemCollector {
struct BadImplStripper<'a> {
prims: FxHashSet<PrimitiveType>,
items: FxHashSet<ItemId>,
crate cache: &'a Cache,
cache: &'a Cache,
}
impl<'a> BadImplStripper<'a> {

View file

@ -144,7 +144,7 @@ impl<'a> DocFolder for ImplStripper<'a> {
}
if let Some(generics) = imp.trait_.as_ref().and_then(|t| t.generics()) {
for typaram in generics {
if let Some(did) = typaram.def_id_no_primitives() {
if let Some(did) = typaram.def_id(self.cache) {
if did.is_local() && !self.retained.contains(&did.into()) {
debug!(
"ImplStripper: stripped item in trait's generics; removing impl"