@@ -1174,6 +1174,16 @@ impl DocFolder for Cache {
1174
1174
_ => self . stripped_mod ,
1175
1175
} ;
1176
1176
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
+
1177
1187
// Register any generics to their corresponding string. This is used
1178
1188
// when pretty-printing types.
1179
1189
if let Some ( generics) = item. inner . generics ( ) {
@@ -1188,14 +1198,10 @@ impl DocFolder for Cache {
1188
1198
1189
1199
// Collect all the implementors of traits.
1190
1200
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
+ } ) ;
1199
1205
}
1200
1206
}
1201
1207
@@ -1358,24 +1364,20 @@ impl DocFolder for Cache {
1358
1364
// Note: matching twice to restrict the lifetime of the `i` borrow.
1359
1365
let mut dids = FxHashSet ( ) ;
1360
1366
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
+ } ) ;
1375
1378
1376
- if let Some ( did) = did {
1377
- dids. insert ( did) ;
1378
- }
1379
+ if let Some ( did) = did {
1380
+ dids. insert ( did) ;
1379
1381
}
1380
1382
}
1381
1383
}
0 commit comments