1
Fork 0

Calculate stability, const_stability, and deprecation on-demand

Previously, they would always be calculated ahead of time, which bloated
the size of `clean::Item`.
This commit is contained in:
Joshua Nelson 2020-12-16 15:54:05 -05:00
parent d8d3ab96aa
commit 1523f67f16
7 changed files with 75 additions and 80 deletions

View file

@ -17,17 +17,8 @@ use crate::json::JsonRenderer;
impl JsonRenderer<'_> {
pub(super) fn convert_item(&self, item: clean::Item) -> Option<Item> {
let item_type = ItemType::from(&item);
let clean::Item {
source,
name,
attrs,
kind,
visibility,
def_id,
stability: _,
const_stability: _,
deprecation,
} = item;
let deprecation = item.deprecation(self.tcx);
let clean::Item { source, name, attrs, kind, visibility, def_id } = item;
match kind {
clean::StrippedItem(_) => None,
_ => Some(Item {