Skip to content

Commit cca4eea

Browse files
committed
Simplify conversion
1 parent 3c28069 commit cca4eea

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

src/librustdoc/json/mod.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -205,21 +205,14 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
205205
debug!("Done with crate");
206206
let mut index = (*self.index).clone().into_inner();
207207
index.extend(self.get_trait_items());
208-
let len = index.len();
209208
// This needs to be the default HashMap for compatibility with the public interface for
210209
// rustdoc-json
211210
#[allow(rustc::default_hash_types)]
212211
let output = types::Crate {
213212
root: types::Id(String::from("0:0")),
214213
crate_version: krate.version.clone(),
215214
includes_private: self.cache.document_private,
216-
index: index.into_iter().fold(
217-
std::collections::HashMap::with_capacity(len),
218-
|mut acc, (key, val)| {
219-
acc.insert(key, val);
220-
acc
221-
},
222-
),
215+
index: index.into_iter().collect(),
223216
paths: self
224217
.cache
225218
.paths

0 commit comments

Comments
 (0)