Rename def_id
into item_id
when the type is ItemId
for readability
This commit is contained in:
parent
f9d4d12b6a
commit
b1e6211c5c
23 changed files with 121 additions and 120 deletions
|
@ -186,8 +186,8 @@ impl Cache {
|
|||
|
||||
impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> {
|
||||
fn fold_item(&mut self, item: clean::Item) -> Option<clean::Item> {
|
||||
if item.def_id.is_local() {
|
||||
debug!("folding {} \"{:?}\", id {:?}", item.type_(), item.name, item.def_id);
|
||||
if item.item_id.is_local() {
|
||||
debug!("folding {} \"{:?}\", id {:?}", item.type_(), item.name, item.item_id);
|
||||
}
|
||||
|
||||
// If this is a stripped module,
|
||||
|
@ -202,7 +202,7 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> {
|
|||
// If the impl is from a masked crate or references something from a
|
||||
// masked crate then remove it completely.
|
||||
if let clean::ImplItem(ref i) = *item.kind {
|
||||
if self.cache.masked_crates.contains(&item.def_id.krate())
|
||||
if self.cache.masked_crates.contains(&item.item_id.krate())
|
||||
|| i.trait_
|
||||
.as_ref()
|
||||
.map_or(false, |t| self.cache.masked_crates.contains(&t.def_id().krate))
|
||||
|
@ -217,7 +217,7 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> {
|
|||
// Propagate a trait method's documentation to all implementors of the
|
||||
// trait.
|
||||
if let clean::TraitItem(ref t) = *item.kind {
|
||||
self.cache.traits.entry(item.def_id.expect_def_id()).or_insert_with(|| {
|
||||
self.cache.traits.entry(item.item_id.expect_def_id()).or_insert_with(|| {
|
||||
clean::TraitWithExtraInfo {
|
||||
trait_: t.clone(),
|
||||
is_notable: item.attrs.has_doc_flag(sym::notable_trait),
|
||||
|
@ -293,7 +293,7 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> {
|
|||
// A crate has a module at its root, containing all items,
|
||||
// which should not be indexed. The crate-item itself is
|
||||
// inserted later on when serializing the search-index.
|
||||
if item.def_id.index().map_or(false, |idx| idx != CRATE_DEF_INDEX) {
|
||||
if item.item_id.index().map_or(false, |idx| idx != CRATE_DEF_INDEX) {
|
||||
let desc = item.doc_value().map_or_else(String::new, |x| {
|
||||
short_markdown_summary(x.as_str(), &item.link_names(self.cache))
|
||||
});
|
||||
|
@ -351,11 +351,11 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> {
|
|||
// `public_items` map, so we can skip inserting into the
|
||||
// paths map if there was already an entry present and we're
|
||||
// not a public item.
|
||||
if !self.cache.paths.contains_key(&item.def_id.expect_def_id())
|
||||
|| self.cache.access_levels.is_public(item.def_id.expect_def_id())
|
||||
if !self.cache.paths.contains_key(&item.item_id.expect_def_id())
|
||||
|| self.cache.access_levels.is_public(item.item_id.expect_def_id())
|
||||
{
|
||||
self.cache.paths.insert(
|
||||
item.def_id.expect_def_id(),
|
||||
item.item_id.expect_def_id(),
|
||||
(self.cache.stack.clone(), item.type_()),
|
||||
);
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> {
|
|||
clean::PrimitiveItem(..) => {
|
||||
self.cache
|
||||
.paths
|
||||
.insert(item.def_id.expect_def_id(), (self.cache.stack.clone(), item.type_()));
|
||||
.insert(item.item_id.expect_def_id(), (self.cache.stack.clone(), item.type_()));
|
||||
}
|
||||
|
||||
clean::ExternCrateItem { .. }
|
||||
|
@ -396,7 +396,7 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> {
|
|||
| clean::StructItem(..)
|
||||
| clean::UnionItem(..)
|
||||
| clean::VariantItem(..) => {
|
||||
self.cache.parent_stack.push(item.def_id.expect_def_id());
|
||||
self.cache.parent_stack.push(item.item_id.expect_def_id());
|
||||
self.cache.parent_is_trait_impl = false;
|
||||
true
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue