@@ -1243,6 +1243,16 @@ impl DocFolder for Cache {
12431243 _ => self . stripped_mod ,
12441244 } ;
12451245
1246+ // If the impl is from a masked crate or references something from a
1247+ // masked crate then remove it completely.
1248+ if let clean:: ImplItem ( ref i) = item. inner {
1249+ if self . masked_crates . contains ( & item. def_id . krate ) ||
1250+ i. trait_ . def_id ( ) . map_or ( false , |d| self . masked_crates . contains ( & d. krate ) ) ||
1251+ i. for_ . def_id ( ) . map_or ( false , |d| self . masked_crates . contains ( & d. krate ) ) {
1252+ return None ;
1253+ }
1254+ }
1255+
12461256 // Register any generics to their corresponding string. This is used
12471257 // when pretty-printing types.
12481258 if let Some ( generics) = item. inner . generics ( ) {
@@ -1257,14 +1267,10 @@ impl DocFolder for Cache {
12571267
12581268 // Collect all the implementors of traits.
12591269 if let clean:: ImplItem ( ref i) = item. inner {
1260- if !self . masked_crates . contains ( & item. def_id . krate ) {
1261- if let Some ( did) = i. trait_ . def_id ( ) {
1262- if i. for_ . def_id ( ) . map_or ( true , |d| !self . masked_crates . contains ( & d. krate ) ) {
1263- self . implementors . entry ( did) . or_insert ( vec ! [ ] ) . push ( Impl {
1264- impl_item : item. clone ( ) ,
1265- } ) ;
1266- }
1267- }
1270+ if let Some ( did) = i. trait_ . def_id ( ) {
1271+ self . implementors . entry ( did) . or_insert ( vec ! [ ] ) . push ( Impl {
1272+ impl_item : item. clone ( ) ,
1273+ } ) ;
12681274 }
12691275 }
12701276
@@ -1427,24 +1433,20 @@ impl DocFolder for Cache {
14271433 // Note: matching twice to restrict the lifetime of the `i` borrow.
14281434 let mut dids = FxHashSet ( ) ;
14291435 if let clean:: Item { inner : clean:: ImplItem ( ref i) , .. } = item {
1430- let masked_trait = i. trait_ . def_id ( ) . map_or ( false ,
1431- |d| self . masked_crates . contains ( & d. krate ) ) ;
1432- if !masked_trait {
1433- match i. for_ {
1434- clean:: ResolvedPath { did, .. } |
1435- clean:: BorrowedRef {
1436- type_ : box clean:: ResolvedPath { did, .. } , ..
1437- } => {
1438- dids. insert ( did) ;
1439- }
1440- ref t => {
1441- let did = t. primitive_type ( ) . and_then ( |t| {
1442- self . primitive_locations . get ( & t) . cloned ( )
1443- } ) ;
1436+ match i. for_ {
1437+ clean:: ResolvedPath { did, .. } |
1438+ clean:: BorrowedRef {
1439+ type_ : box clean:: ResolvedPath { did, .. } , ..
1440+ } => {
1441+ dids. insert ( did) ;
1442+ }
1443+ ref t => {
1444+ let did = t. primitive_type ( ) . and_then ( |t| {
1445+ self . primitive_locations . get ( & t) . cloned ( )
1446+ } ) ;
14441447
1445- if let Some ( did) = did {
1446- dids. insert ( did) ;
1447- }
1448+ if let Some ( did) = did {
1449+ dids. insert ( did) ;
14481450 }
14491451 }
14501452 }
0 commit comments