Skip to content

Commit

Permalink
Get rid of clean::TyMethod
Browse files Browse the repository at this point in the history
It's the same as clean::Function.
  • Loading branch information
jyn514 committed Nov 17, 2020
1 parent 9b2b02a commit b3f9795
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/librustdoc/clean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down Expand Up @@ -1249,7 +1249,7 @@ impl Clean<Item> for ty::AssocItem {
ret_types,
})
} else {
TyMethodItem(TyMethod {
TyMethodItem(Function {
generics,
decl,
header: hir::FnHeader {
Expand Down
11 changes: 1 addition & 10 deletions src/librustdoc/clean/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions src/librustdoc/html/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit b3f9795

Please sign in to comment.