Skip to content

Commit

Permalink
Simplify conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
CraftSpider committed Jan 22, 2021
1 parent 1a78a89 commit c28427a
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions src/librustdoc/json/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,21 +210,11 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
debug!("Done with crate");
let mut index = (*self.index).clone().into_inner();
index.extend(self.get_trait_items(cache));
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)]
let output = types::Crate {
root: types::Id(String::from("0:0")),
crate_version: krate.version.clone(),
includes_private: 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: cache
.paths
.clone()
Expand Down

0 comments on commit c28427a

Please sign in to comment.