Fix the JSON backend
This was simpler than expected.
This commit is contained in:
parent
4fa95b3a07
commit
0e574fb39a
2 changed files with 25 additions and 23 deletions
|
@ -26,6 +26,7 @@ use crate::html::render::cache::ExternalLocation;
|
|||
|
||||
#[derive(Clone)]
|
||||
crate struct JsonRenderer {
|
||||
sess: Lrc<Session>,
|
||||
/// A mapping of IDs that contains all local items for this crate which gets output as a top
|
||||
/// level field of the JSON blob.
|
||||
index: Rc<RefCell<FxHashMap<types::Id, types::Item>>>,
|
||||
|
@ -126,11 +127,12 @@ impl FormatRenderer for JsonRenderer {
|
|||
_render_info: RenderInfo,
|
||||
_edition: Edition,
|
||||
_cache: &mut Cache,
|
||||
_sess: Lrc<Session>,
|
||||
sess: Lrc<Session>,
|
||||
) -> Result<(Self, clean::Crate), Error> {
|
||||
debug!("Initializing json renderer");
|
||||
Ok((
|
||||
JsonRenderer {
|
||||
sess,
|
||||
index: Rc::new(RefCell::new(FxHashMap::default())),
|
||||
out_path: options.output,
|
||||
},
|
||||
|
@ -146,7 +148,7 @@ impl FormatRenderer for JsonRenderer {
|
|||
item.kind.inner_items().for_each(|i| self.item(i.clone(), cache).unwrap());
|
||||
|
||||
let id = item.def_id;
|
||||
if let Some(mut new_item) = item.into(): Option<types::Item> {
|
||||
if let Some(mut new_item) = self.convert_item(item) {
|
||||
if let types::ItemEnum::TraitItem(ref mut t) = new_item.inner {
|
||||
t.implementors = self.get_trait_implementors(id, cache)
|
||||
} else if let types::ItemEnum::StructItem(ref mut s) = new_item.inner {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue