@@ -259,12 +259,6 @@ declare_lint! {
259259}
260260
261261pub 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-
268262 /// Stack of whether #[doc(hidden)] is set
269263 /// at each level which has lint attributes.
270264 doc_hidden_stack : Vec < bool > ,
@@ -276,8 +270,6 @@ pub struct MissingDoc {
276270impl MissingDoc {
277271 pub fn new ( ) -> MissingDoc {
278272 MissingDoc {
279- struct_def_stack : vec ! [ ] ,
280- in_variant : false ,
281273 doc_hidden_stack : vec ! [ false ] ,
282274 private_traits : HashSet :: new ( ) ,
283275 }
@@ -345,25 +337,6 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
345337 self . doc_hidden_stack . pop ( ) . expect ( "empty doc_hidden_stack" ) ;
346338 }
347339
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-
367340 fn check_crate ( & mut self , cx : & LateContext , krate : & hir:: Crate ) {
368341 self . check_missing_docs_attrs ( cx, None , & krate. attrs , krate. span , "crate" ) ;
369342 }
@@ -451,16 +424,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
451424
452425 fn check_struct_field ( & mut self , cx : & LateContext , sf : & hir:: StructField ) {
453426 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" )
464432 }
465433 }
466434
@@ -470,13 +438,6 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
470438 & v. node . attrs ,
471439 v. span ,
472440 "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 ;
480441 }
481442}
482443
0 commit comments