Skip to content

Commit a6aa3cb

Browse files
committed
inline ItemId method, clarify comments a bit
1 parent 74f0e58 commit a6aa3cb

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

src/librustdoc/clean/types.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,6 @@ impl ItemId {
7575
}
7676
}
7777

78-
#[inline]
79-
crate fn is_local_impl(self) -> bool {
80-
match self {
81-
ItemId::Blanket { impl_id, .. } => impl_id.is_local(),
82-
ItemId::Auto { .. } | ItemId::DefId(_) | ItemId::Primitive(_, _) => false,
83-
}
84-
}
85-
8678
#[inline]
8779
#[track_caller]
8880
crate fn expect_def_id(self) -> DefId {

src/librustdoc/json/mod.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,17 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
171171
/// the hashmap because certain items (traits and types) need to have their mappings for trait
172172
/// implementations filled out before they're inserted.
173173
fn item(&mut self, item: clean::Item) -> Result<(), Error> {
174+
// We skip children of local blanket implementations, as we'll have already seen the actual
175+
// generic impl, and the generated ones don't need documenting.
176+
let local_blanket_impl = match item.def_id {
177+
clean::ItemId::Blanket { impl_id, .. } => impl_id.is_local(),
178+
clean::ItemId::Auto { .. }
179+
| clean::ItemId::DefId(_)
180+
| clean::ItemId::Primitive(_, _) => false,
181+
};
182+
174183
// Flatten items that recursively store other items
175-
// We skip local blanket implementations, as we'll have already seen the actual generic
176-
// impl, and the generated ones don't need documenting.
177-
if !item.def_id.is_local_impl() {
184+
if !local_blanket_impl {
178185
item.kind.inner_items().for_each(|i| self.item(i.clone()).unwrap());
179186
}
180187

0 commit comments

Comments
 (0)