Skip to content

Commit 88d4144

Browse files
committed
Migrate VariantKind constructor to Clean impl.
#36903 (comment)
1 parent b55468c commit 88d4144

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/librustdoc/clean/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2025,7 +2025,7 @@ impl Clean<Item> for doctree::Variant {
20252025
deprecation: self.depr.clean(cx),
20262026
def_id: cx.map.local_def_id(self.def.id()),
20272027
inner: VariantItem(Variant {
2028-
kind: VariantKind::from_struct_def(&self.def, cx),
2028+
kind: self.def.clean(cx),
20292029
}),
20302030
}
20312031
}
@@ -2079,14 +2079,14 @@ pub enum VariantKind {
20792079
StructVariant(VariantStruct),
20802080
}
20812081

2082-
impl VariantKind {
2083-
fn from_struct_def(struct_def: &hir::VariantData, cx: &DocContext) -> VariantKind {
2084-
if struct_def.is_struct() {
2085-
StructVariant(struct_def.clean(cx))
2086-
} else if struct_def.is_unit() {
2082+
impl Clean<VariantKind> for hir::VariantData {
2083+
fn clean(&self, cx: &DocContext) -> VariantKind {
2084+
if self.is_struct() {
2085+
StructVariant(self.clean(cx))
2086+
} else if self.is_unit() {
20872087
CLikeVariant
20882088
} else {
2089-
TupleVariant(struct_def.fields().iter().map(|x| x.ty.clean(cx)).collect())
2089+
TupleVariant(self.fields().iter().map(|x| x.ty.clean(cx)).collect())
20902090
}
20912091
}
20922092
}

0 commit comments

Comments
 (0)