@@ -259,12 +259,6 @@ declare_lint! {
259
259
}
260
260
261
261
pub struct MissingDoc {
262
- /// Stack of IDs of struct definitions.
263
- struct_def_stack : Vec < ast:: NodeId > ,
264
-
265
- /// True if inside variant definition
266
- in_variant : bool ,
267
-
268
262
/// Stack of whether #[doc(hidden)] is set
269
263
/// at each level which has lint attributes.
270
264
doc_hidden_stack : Vec < bool > ,
@@ -276,8 +270,6 @@ pub struct MissingDoc {
276
270
impl MissingDoc {
277
271
pub fn new ( ) -> MissingDoc {
278
272
MissingDoc {
279
- struct_def_stack : vec ! [ ] ,
280
- in_variant : false ,
281
273
doc_hidden_stack : vec ! [ false ] ,
282
274
private_traits : HashSet :: new ( ) ,
283
275
}
@@ -345,25 +337,6 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
345
337
self . doc_hidden_stack . pop ( ) . expect ( "empty doc_hidden_stack" ) ;
346
338
}
347
339
348
- fn check_struct_def ( & mut self ,
349
- _: & LateContext ,
350
- _: & hir:: VariantData ,
351
- _: ast:: Name ,
352
- _: & hir:: Generics ,
353
- item_id : ast:: NodeId ) {
354
- self . struct_def_stack . push ( item_id) ;
355
- }
356
-
357
- fn check_struct_def_post ( & mut self ,
358
- _: & LateContext ,
359
- _: & hir:: VariantData ,
360
- _: ast:: Name ,
361
- _: & hir:: Generics ,
362
- item_id : ast:: NodeId ) {
363
- let popped = self . struct_def_stack . pop ( ) . expect ( "empty struct_def_stack" ) ;
364
- assert ! ( popped == item_id) ;
365
- }
366
-
367
340
fn check_crate ( & mut self , cx : & LateContext , krate : & hir:: Crate ) {
368
341
self . check_missing_docs_attrs ( cx, None , & krate. attrs , krate. span , "crate" ) ;
369
342
}
@@ -451,16 +424,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
451
424
452
425
fn check_struct_field ( & mut self , cx : & LateContext , sf : & hir:: StructField ) {
453
426
if !sf. is_positional ( ) {
454
- if sf. vis == hir:: Public || self . in_variant {
455
- let cur_struct_def = * self . struct_def_stack
456
- . last ( )
457
- . expect ( "empty struct_def_stack" ) ;
458
- self . check_missing_docs_attrs ( cx,
459
- Some ( cur_struct_def) ,
460
- & sf. attrs ,
461
- sf. span ,
462
- "a struct field" )
463
- }
427
+ self . check_missing_docs_attrs ( cx,
428
+ Some ( sf. id ) ,
429
+ & sf. attrs ,
430
+ sf. span ,
431
+ "a struct field" )
464
432
}
465
433
}
466
434
@@ -470,13 +438,6 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
470
438
& v. node . attrs ,
471
439
v. span ,
472
440
"a variant" ) ;
473
- assert ! ( !self . in_variant) ;
474
- self . in_variant = true ;
475
- }
476
-
477
- fn check_variant_post ( & mut self , _: & LateContext , _: & hir:: Variant , _: & hir:: Generics ) {
478
- assert ! ( self . in_variant) ;
479
- self . in_variant = false ;
480
441
}
481
442
}
482
443
0 commit comments