1
Fork 0

Get rid of clean::TyMethod

It's the same as clean::Function.
This commit is contained in:
Joshua Nelson 2020-11-16 22:53:10 -05:00
parent 9b2b02a840
commit b3f9795cbb
3 changed files with 4 additions and 14 deletions

View file

@ -1120,7 +1120,7 @@ impl Clean<Item> for hir::TraitItem<'_> {
(self.generics.clean(cx), (&*sig.decl, &names[..]).clean(cx))
});
let (all_types, ret_types) = get_all_types(&generics, &decl, cx);
let mut t = TyMethod { header: sig.header, decl, generics, all_types, ret_types };
let mut t = Function { header: sig.header, decl, generics, all_types, ret_types };
if t.header.constness == hir::Constness::Const
&& is_unstable_const_fn(cx.tcx, local_did.to_def_id()).is_some()
{
@ -1249,7 +1249,7 @@ impl Clean<Item> for ty::AssocItem {
ret_types,
})
} else {
TyMethodItem(TyMethod {
TyMethodItem(Function {
generics,
decl,
header: hir::FnHeader {

View file

@ -264,7 +264,7 @@ crate enum ItemKind {
ImplItem(Impl),
/// A method signature only. Used for required methods in traits (ie,
/// non-default-methods).
TyMethodItem(TyMethod),
TyMethodItem(Function),
/// A method with a body.
MethodItem(Method),
StructFieldItem(Type),
@ -920,15 +920,6 @@ crate struct Method {
crate ret_types: Vec<(Type, TypeKind)>,
}
#[derive(Clone, Debug)]
crate struct TyMethod {
crate header: hir::FnHeader,
crate decl: FnDecl,
crate generics: Generics,
crate all_types: Vec<(Type, TypeKind)>,
crate ret_types: Vec<(Type, TypeKind)>,
}
#[derive(Clone, Debug)]
crate struct Function {
crate decl: FnDecl,

View file

@ -3752,8 +3752,7 @@ fn render_impl(
(true, " hidden")
};
match item.kind {
clean::MethodItem(clean::Method { .. })
| clean::TyMethodItem(clean::TyMethod { .. }) => {
clean::MethodItem(_) | clean::TyMethodItem(_) => {
// Only render when the method is not static or we allow static methods
if render_method_item {
let id = cx.derive_id(format!("{}.{}", item_type, name));