Simplify conversion

This commit is contained in:
Rune Tynan 2021-01-22 18:30:01 -05:00
parent 3c2806957e
commit cca4eea6f9
No known key found for this signature in database
GPG key ID: 7ECC932F8B2C731E

View file

@ -205,7 +205,6 @@ fn after_krate(
debug!("Done with crate");
let mut index = (*self.index).clone().into_inner();
index.extend(self.get_trait_items());
let len = index.len();
// This needs to be the default HashMap for compatibility with the public interface for
// rustdoc-json
#[allow(rustc::default_hash_types)]
@ -213,13 +212,7 @@ fn after_krate(
root: types::Id(String::from("0:0")),
crate_version: krate.version.clone(),
includes_private: self.cache.document_private,
index: index.into_iter().fold(
std::collections::HashMap::with_capacity(len),
|mut acc, (key, val)| {
acc.insert(key, val);
acc
},
),
index: index.into_iter().collect(),
paths: self
.cache
.paths