Improve code a bit
This commit is contained in:
parent
c7491b9733
commit
20ed9712a7
2 changed files with 15 additions and 17 deletions
|
|
@ -3002,22 +3002,22 @@ fn clean_use_statement_inner<'tcx>(
|
|||
// were specifically asked for it
|
||||
denied = true;
|
||||
}
|
||||
if !denied {
|
||||
if let Some(mut items) = inline::try_inline(
|
||||
if !denied
|
||||
&& let Some(mut items) = inline::try_inline(
|
||||
cx,
|
||||
path.res,
|
||||
name,
|
||||
Some((attrs, Some(import_def_id))),
|
||||
&mut Default::default(),
|
||||
) {
|
||||
items.push(Item::from_def_id_and_parts(
|
||||
import_def_id,
|
||||
None,
|
||||
ImportItem(Import::new_simple(name, resolve_use_source(cx, path), false)),
|
||||
cx,
|
||||
));
|
||||
return items;
|
||||
}
|
||||
)
|
||||
{
|
||||
items.push(Item::from_def_id_and_parts(
|
||||
import_def_id,
|
||||
None,
|
||||
ImportItem(Import::new_simple(name, resolve_use_source(cx, path), false)),
|
||||
cx,
|
||||
));
|
||||
return items;
|
||||
}
|
||||
Import::new_simple(name, resolve_use_source(cx, path), true)
|
||||
};
|
||||
|
|
|
|||
|
|
@ -203,10 +203,10 @@ impl Cache {
|
|||
impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> {
|
||||
fn fold_item(&mut self, item: clean::Item) -> Option<clean::Item> {
|
||||
if item.item_id.is_local() {
|
||||
let is_stripped = matches!(*item.kind, clean::ItemKind::StrippedItem(..));
|
||||
debug!(
|
||||
"folding {} (stripped: {is_stripped:?}) \"{:?}\", id {:?}",
|
||||
"folding {} (stripped: {:?}) \"{:?}\", id {:?}",
|
||||
item.type_(),
|
||||
item.is_stripped(),
|
||||
item.name,
|
||||
item.item_id
|
||||
);
|
||||
|
|
@ -246,13 +246,11 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> {
|
|||
// trait.
|
||||
if let clean::TraitItem(ref t) = *item.kind {
|
||||
self.cache.traits.entry(item.item_id.expect_def_id()).or_insert_with(|| (**t).clone());
|
||||
}
|
||||
|
||||
// Collect all the implementors of traits.
|
||||
if let clean::ImplItem(ref i) = *item.kind
|
||||
} else if let clean::ImplItem(ref i) = *item.kind
|
||||
&& let Some(trait_) = &i.trait_
|
||||
&& !i.kind.is_blanket()
|
||||
{
|
||||
// Collect all the implementors of traits.
|
||||
self.cache
|
||||
.implementors
|
||||
.entry(trait_.def_id())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue