@@ -1174,6 +1174,16 @@ impl DocFolder for Cache {
11741174 _ => self . stripped_mod ,
11751175 } ;
11761176
1177+ // If the impl is from a masked crate or references something from a
1178+ // masked crate then remove it completely.
1179+ if let clean:: ImplItem ( ref i) = item. inner {
1180+ if self . masked_crates . contains ( & item. def_id . krate ) ||
1181+ i. trait_ . def_id ( ) . map_or ( false , |d| self . masked_crates . contains ( & d. krate ) ) ||
1182+ i. for_ . def_id ( ) . map_or ( false , |d| self . masked_crates . contains ( & d. krate ) ) {
1183+ return None ;
1184+ }
1185+ }
1186+
11771187 // Register any generics to their corresponding string. This is used
11781188 // when pretty-printing types.
11791189 if let Some ( generics) = item. inner . generics ( ) {
@@ -1188,14 +1198,10 @@ impl DocFolder for Cache {
11881198
11891199 // Collect all the implementors of traits.
11901200 if let clean:: ImplItem ( ref i) = item. inner {
1191- if !self . masked_crates . contains ( & item. def_id . krate ) {
1192- if let Some ( did) = i. trait_ . def_id ( ) {
1193- if i. for_ . def_id ( ) . map_or ( true , |d| !self . masked_crates . contains ( & d. krate ) ) {
1194- self . implementors . entry ( did) . or_insert ( vec ! [ ] ) . push ( Impl {
1195- impl_item : item. clone ( ) ,
1196- } ) ;
1197- }
1198- }
1201+ if let Some ( did) = i. trait_ . def_id ( ) {
1202+ self . implementors . entry ( did) . or_insert ( vec ! [ ] ) . push ( Impl {
1203+ impl_item : item. clone ( ) ,
1204+ } ) ;
11991205 }
12001206 }
12011207
@@ -1358,24 +1364,20 @@ impl DocFolder for Cache {
13581364 // Note: matching twice to restrict the lifetime of the `i` borrow.
13591365 let mut dids = FxHashSet ( ) ;
13601366 if let clean:: Item { inner : clean:: ImplItem ( ref i) , .. } = item {
1361- let masked_trait = i. trait_ . def_id ( ) . map_or ( false ,
1362- |d| self . masked_crates . contains ( & d. krate ) ) ;
1363- if !masked_trait {
1364- match i. for_ {
1365- clean:: ResolvedPath { did, .. } |
1366- clean:: BorrowedRef {
1367- type_ : box clean:: ResolvedPath { did, .. } , ..
1368- } => {
1369- dids. insert ( did) ;
1370- }
1371- ref t => {
1372- let did = t. primitive_type ( ) . and_then ( |t| {
1373- self . primitive_locations . get ( & t) . cloned ( )
1374- } ) ;
1367+ match i. for_ {
1368+ clean:: ResolvedPath { did, .. } |
1369+ clean:: BorrowedRef {
1370+ type_ : box clean:: ResolvedPath { did, .. } , ..
1371+ } => {
1372+ dids. insert ( did) ;
1373+ }
1374+ ref t => {
1375+ let did = t. primitive_type ( ) . and_then ( |t| {
1376+ self . primitive_locations . get ( & t) . cloned ( )
1377+ } ) ;
13751378
1376- if let Some ( did) = did {
1377- dids. insert ( did) ;
1378- }
1379+ if let Some ( did) = did {
1380+ dids. insert ( did) ;
13791381 }
13801382 }
13811383 }
0 commit comments