| 
1 | 1 | use std::cell::RefCell;  | 
2 | 2 | use std::default::Default;  | 
3 | 3 | use std::hash::{Hash, Hasher};  | 
4 |  | -use std::iter::FromIterator;  | 
5 | 4 | use std::lazy::SyncOnceCell as OnceCell;  | 
6 | 5 | use std::path::PathBuf;  | 
7 | 6 | use std::rc::Rc;  | 
@@ -958,16 +957,14 @@ fn add_doc_fragment(out: &mut String, frag: &DocFragment) {  | 
958 | 957 |     }  | 
959 | 958 | }  | 
960 | 959 | 
 
  | 
961 |  | -impl<'a> FromIterator<&'a DocFragment> for String {  | 
962 |  | -    fn from_iter<T>(iter: T) -> Self  | 
963 |  | -    where  | 
964 |  | -        T: IntoIterator<Item = &'a DocFragment>,  | 
965 |  | -    {  | 
966 |  | -        iter.into_iter().fold(String::new(), |mut acc, frag| {  | 
967 |  | -            add_doc_fragment(&mut acc, frag);  | 
968 |  | -            acc  | 
969 |  | -        })  | 
 | 960 | +/// Collapse a collection of [`DocFragment`]s into one string,  | 
 | 961 | +/// handling indentation and newlines as needed.  | 
 | 962 | +crate fn collapse_doc_fragments(doc_strings: &[DocFragment]) -> String {  | 
 | 963 | +    let mut acc = String::new();  | 
 | 964 | +    for frag in doc_strings {  | 
 | 965 | +        add_doc_fragment(&mut acc, frag);  | 
970 | 966 |     }  | 
 | 967 | +    acc  | 
971 | 968 | }  | 
972 | 969 | 
 
  | 
973 | 970 | /// A link that has not yet been rendered.  | 
@@ -1113,7 +1110,11 @@ impl Attributes {  | 
1113 | 1110 |     /// Finds all `doc` attributes as NameValues and returns their corresponding values, joined  | 
1114 | 1111 |     /// with newlines.  | 
1115 | 1112 |     crate fn collapsed_doc_value(&self) -> Option<String> {  | 
1116 |  | -        if self.doc_strings.is_empty() { None } else { Some(self.doc_strings.iter().collect()) }  | 
 | 1113 | +        if self.doc_strings.is_empty() {  | 
 | 1114 | +            None  | 
 | 1115 | +        } else {  | 
 | 1116 | +            Some(collapse_doc_fragments(&self.doc_strings))  | 
 | 1117 | +        }  | 
1117 | 1118 |     }  | 
1118 | 1119 | 
 
  | 
1119 | 1120 |     crate fn get_doc_aliases(&self) -> Box<[Symbol]> {  | 
 | 
0 commit comments