@@ -393,24 +393,6 @@ pub enum DocFragmentKind {
393
393
/// A doc fragment created from a `#[doc(include="filename")]` attribute. Contains both the
394
394
/// given filename and the file contents.
395
395
Include { filename : String } ,
396
- /// A doc fragment used to distinguish between documentation in different modules.
397
- ///
398
- /// In particular, this prevents `collapse_docs` from turning all documentation comments
399
- /// into a single giant attributes even when the item is re-exported with documentation on the re-export.
400
- Divider ,
401
- }
402
-
403
- impl DocFragment {
404
- /// Creates a dummy doc-fragment which divides earlier and later fragments.
405
- fn divider ( ) -> Self {
406
- DocFragment {
407
- line : 0 ,
408
- span : DUMMY_SP ,
409
- parent_module : None ,
410
- doc : String :: new ( ) ,
411
- kind : DocFragmentKind :: Divider ,
412
- }
413
- }
414
396
}
415
397
416
398
impl < ' a > FromIterator < & ' a DocFragment > for String {
@@ -551,7 +533,7 @@ impl Attributes {
551
533
attrs : & [ ast:: Attribute ] ,
552
534
additional_attrs : Option < ( & [ ast:: Attribute ] , DefId ) > ,
553
535
) -> Attributes {
554
- let doc_strings = RefCell :: new ( vec ! [ ] ) ;
536
+ let mut doc_strings = vec ! [ ] ;
555
537
let mut sp = None ;
556
538
let mut cfg = Cfg :: True ;
557
539
let mut doc_line = 0 ;
@@ -568,7 +550,7 @@ impl Attributes {
568
550
569
551
let line = doc_line;
570
552
doc_line += value. lines ( ) . count ( ) ;
571
- doc_strings. borrow_mut ( ) . push ( DocFragment {
553
+ doc_strings. push ( DocFragment {
572
554
line,
573
555
span : attr. span ,
574
556
doc : value,
@@ -593,7 +575,7 @@ impl Attributes {
593
575
{
594
576
let line = doc_line;
595
577
doc_line += contents. lines ( ) . count ( ) ;
596
- doc_strings. borrow_mut ( ) . push ( DocFragment {
578
+ doc_strings. push ( DocFragment {
597
579
line,
598
580
span : attr. span ,
599
581
doc : contents,
@@ -610,10 +592,7 @@ impl Attributes {
610
592
// Additional documentation should be shown before the original documentation
611
593
let other_attrs = additional_attrs
612
594
. into_iter ( )
613
- . map ( |( attrs, id) | {
614
- doc_strings. borrow_mut ( ) . push ( DocFragment :: divider ( ) ) ;
615
- attrs. iter ( ) . map ( move |attr| ( attr, Some ( id) ) )
616
- } )
595
+ . map ( |( attrs, id) | attrs. iter ( ) . map ( move |attr| ( attr, Some ( id) ) ) )
617
596
. flatten ( )
618
597
. chain ( attrs. iter ( ) . map ( |attr| ( attr, None ) ) )
619
598
. filter_map ( clean_attr)
@@ -642,7 +621,7 @@ impl Attributes {
642
621
. map_or ( true , |a| a. style == AttrStyle :: Inner ) ;
643
622
644
623
Attributes {
645
- doc_strings : doc_strings . into_inner ( ) ,
624
+ doc_strings,
646
625
other_attrs,
647
626
cfg : if cfg == Cfg :: True { None } else { Some ( Arc :: new ( cfg) ) } ,
648
627
span : sp,
0 commit comments