rustdoc: Remove top-level wrappers for ImplKind
methods
The `ImplKind` methods can just be used directly instead.
This commit is contained in:
parent
7c7bf451eb
commit
b5817fada2
6 changed files with 8 additions and 20 deletions
|
@ -2182,18 +2182,6 @@ crate struct Impl {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Impl {
|
impl Impl {
|
||||||
crate fn is_auto_impl(&self) -> bool {
|
|
||||||
self.kind.is_auto()
|
|
||||||
}
|
|
||||||
|
|
||||||
crate fn is_blanket_impl(&self) -> bool {
|
|
||||||
self.kind.is_blanket()
|
|
||||||
}
|
|
||||||
|
|
||||||
crate fn blanket_impl_ty(&self) -> Option<&Type> {
|
|
||||||
self.kind.as_blanket_ty()
|
|
||||||
}
|
|
||||||
|
|
||||||
crate fn provided_trait_methods(&self, tcx: TyCtxt<'_>) -> FxHashSet<Symbol> {
|
crate fn provided_trait_methods(&self, tcx: TyCtxt<'_>) -> FxHashSet<Symbol> {
|
||||||
self.trait_
|
self.trait_
|
||||||
.as_ref()
|
.as_ref()
|
||||||
|
|
|
@ -228,7 +228,7 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> {
|
||||||
// Collect all the implementors of traits.
|
// Collect all the implementors of traits.
|
||||||
if let clean::ImplItem(ref i) = *item.kind {
|
if let clean::ImplItem(ref i) = *item.kind {
|
||||||
if let Some(trait_) = &i.trait_ {
|
if let Some(trait_) = &i.trait_ {
|
||||||
if !i.is_blanket_impl() {
|
if !i.kind.is_blanket() {
|
||||||
self.cache
|
self.cache
|
||||||
.implementors
|
.implementors
|
||||||
.entry(trait_.def_id())
|
.entry(trait_.def_id())
|
||||||
|
|
|
@ -999,7 +999,7 @@ impl clean::Impl {
|
||||||
write!(f, " for ")?;
|
write!(f, " for ")?;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(ref ty) = self.blanket_impl_ty() {
|
if let Some(ref ty) = self.kind.as_blanket_ty() {
|
||||||
fmt_type(ty, f, use_absolute, cx)?;
|
fmt_type(ty, f, use_absolute, cx)?;
|
||||||
} else {
|
} else {
|
||||||
fmt_type(&self.for_, f, use_absolute, cx)?;
|
fmt_type(&self.for_, f, use_absolute, cx)?;
|
||||||
|
|
|
@ -1148,9 +1148,9 @@ fn render_assoc_items_inner(
|
||||||
}
|
}
|
||||||
|
|
||||||
let (synthetic, concrete): (Vec<&&Impl>, Vec<&&Impl>) =
|
let (synthetic, concrete): (Vec<&&Impl>, Vec<&&Impl>) =
|
||||||
traits.iter().partition(|t| t.inner_impl().is_auto_impl());
|
traits.iter().partition(|t| t.inner_impl().kind.is_auto());
|
||||||
let (blanket_impl, concrete): (Vec<&&Impl>, _) =
|
let (blanket_impl, concrete): (Vec<&&Impl>, _) =
|
||||||
concrete.into_iter().partition(|t| t.inner_impl().is_blanket_impl());
|
concrete.into_iter().partition(|t| t.inner_impl().kind.is_blanket());
|
||||||
|
|
||||||
let mut impls = Buffer::empty_from(w);
|
let mut impls = Buffer::empty_from(w);
|
||||||
render_impls(cx, &mut impls, &concrete, containing_item);
|
render_impls(cx, &mut impls, &concrete, containing_item);
|
||||||
|
@ -2059,9 +2059,9 @@ fn sidebar_assoc_items(cx: &Context<'_>, out: &mut Buffer, it: &clean::Item) {
|
||||||
};
|
};
|
||||||
|
|
||||||
let (synthetic, concrete): (Vec<&Impl>, Vec<&Impl>) =
|
let (synthetic, concrete): (Vec<&Impl>, Vec<&Impl>) =
|
||||||
v.iter().partition::<Vec<_>, _>(|i| i.inner_impl().is_auto_impl());
|
v.iter().partition::<Vec<_>, _>(|i| i.inner_impl().kind.is_auto());
|
||||||
let (blanket_impl, concrete): (Vec<&Impl>, Vec<&Impl>) =
|
let (blanket_impl, concrete): (Vec<&Impl>, Vec<&Impl>) =
|
||||||
concrete.into_iter().partition::<Vec<_>, _>(|i| i.inner_impl().is_blanket_impl());
|
concrete.into_iter().partition::<Vec<_>, _>(|i| i.inner_impl().kind.is_blanket());
|
||||||
|
|
||||||
let concrete_format = format_impls(concrete);
|
let concrete_format = format_impls(concrete);
|
||||||
let synthetic_format = format_impls(synthetic);
|
let synthetic_format = format_impls(synthetic);
|
||||||
|
|
|
@ -746,7 +746,7 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra
|
||||||
});
|
});
|
||||||
|
|
||||||
let (mut synthetic, mut concrete): (Vec<&&Impl>, Vec<&&Impl>) =
|
let (mut synthetic, mut concrete): (Vec<&&Impl>, Vec<&&Impl>) =
|
||||||
local.iter().partition(|i| i.inner_impl().is_auto_impl());
|
local.iter().partition(|i| i.inner_impl().kind.is_auto());
|
||||||
|
|
||||||
synthetic.sort_by(|a, b| compare_impl(a, b, cx));
|
synthetic.sort_by(|a, b| compare_impl(a, b, cx));
|
||||||
concrete.sort_by(|a, b| compare_impl(a, b, cx));
|
concrete.sort_by(|a, b| compare_impl(a, b, cx));
|
||||||
|
|
|
@ -585,7 +585,7 @@ pub(super) fn write_shared(
|
||||||
} else {
|
} else {
|
||||||
Some(Implementor {
|
Some(Implementor {
|
||||||
text: imp.inner_impl().print(false, cx).to_string(),
|
text: imp.inner_impl().print(false, cx).to_string(),
|
||||||
synthetic: imp.inner_impl().is_auto_impl(),
|
synthetic: imp.inner_impl().kind.is_auto(),
|
||||||
types: collect_paths_for_type(imp.inner_impl().for_.clone(), cache),
|
types: collect_paths_for_type(imp.inner_impl().for_.clone(), cache),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue