Skip to content

Commit

Permalink
Remove unnecessary Clean impl
Browse files Browse the repository at this point in the history
  • Loading branch information
jyn514 committed Oct 11, 2020
1 parent cc0d140 commit 85c0479
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 24 deletions.
4 changes: 2 additions & 2 deletions src/librustdoc/clean/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ pub fn try_inline(
attrs,
inner,
visibility: clean::Public,
stability: cx.tcx.lookup_stability(did).clean(cx),
stability: cx.tcx.lookup_stability(did).cloned(),
deprecation: cx.tcx.lookup_deprecation(did).clean(cx),
def_id: did,
});
Expand Down Expand Up @@ -461,7 +461,7 @@ pub fn build_impl(
name: None,
attrs,
visibility: clean::Inherited,
stability: tcx.lookup_stability(did).clean(cx),
stability: tcx.lookup_stability(did).cloned(),
deprecation: tcx.lookup_deprecation(did).clean(cx),
def_id: did,
});
Expand Down
36 changes: 15 additions & 21 deletions src/librustdoc/clean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ impl Clean<Item> for doctree::Function<'_> {
attrs: self.attrs.clean(cx),
source: self.span.clean(cx),
visibility: self.vis.clean(cx),
stability: cx.stability(self.id).clean(cx),
stability: cx.stability(self.id),
deprecation: cx.deprecation(self.id).clean(cx),
def_id: did.to_def_id(),
inner: FunctionItem(Function {
Expand Down Expand Up @@ -1022,7 +1022,7 @@ impl Clean<Item> for doctree::Trait<'_> {
source: self.span.clean(cx),
def_id: cx.tcx.hir().local_def_id(self.id).to_def_id(),
visibility: self.vis.clean(cx),
stability: cx.stability(self.id).clean(cx),
stability: cx.stability(self.id),
deprecation: cx.deprecation(self.id).clean(cx),
inner: TraitItem(Trait {
auto: self.is_auto.clean(cx),
Expand All @@ -1046,7 +1046,7 @@ impl Clean<Item> for doctree::TraitAlias<'_> {
source: self.span.clean(cx),
def_id: cx.tcx.hir().local_def_id(self.id).to_def_id(),
visibility: self.vis.clean(cx),
stability: cx.stability(self.id).clean(cx),
stability: cx.stability(self.id),
deprecation: cx.deprecation(self.id).clean(cx),
inner: TraitAliasItem(TraitAlias {
generics: self.generics.clean(cx),
Expand Down Expand Up @@ -1831,7 +1831,7 @@ impl Clean<Item> for doctree::Struct<'_> {
source: self.span.clean(cx),
def_id: cx.tcx.hir().local_def_id(self.id).to_def_id(),
visibility: self.vis.clean(cx),
stability: cx.stability(self.id).clean(cx),
stability: cx.stability(self.id),
deprecation: cx.deprecation(self.id).clean(cx),
inner: StructItem(Struct {
struct_type: self.struct_type,
Expand All @@ -1851,7 +1851,7 @@ impl Clean<Item> for doctree::Union<'_> {
source: self.span.clean(cx),
def_id: cx.tcx.hir().local_def_id(self.id).to_def_id(),
visibility: self.vis.clean(cx),
stability: cx.stability(self.id).clean(cx),
stability: cx.stability(self.id),
deprecation: cx.deprecation(self.id).clean(cx),
inner: UnionItem(Union {
struct_type: self.struct_type,
Expand Down Expand Up @@ -1881,7 +1881,7 @@ impl Clean<Item> for doctree::Enum<'_> {
source: self.span.clean(cx),
def_id: cx.tcx.hir().local_def_id(self.id).to_def_id(),
visibility: self.vis.clean(cx),
stability: cx.stability(self.id).clean(cx),
stability: cx.stability(self.id),
deprecation: cx.deprecation(self.id).clean(cx),
inner: EnumItem(Enum {
variants: self.variants.iter().map(|v| v.clean(cx)).collect(),
Expand All @@ -1899,7 +1899,7 @@ impl Clean<Item> for doctree::Variant<'_> {
attrs: self.attrs.clean(cx),
source: self.span.clean(cx),
visibility: Inherited,
stability: cx.stability(self.id).clean(cx),
stability: cx.stability(self.id),
deprecation: cx.deprecation(self.id).clean(cx),
def_id: cx.tcx.hir().local_def_id(self.id).to_def_id(),
inner: VariantItem(Variant { kind: self.def.clean(cx) }),
Expand Down Expand Up @@ -2048,7 +2048,7 @@ impl Clean<Item> for doctree::Typedef<'_> {
source: self.span.clean(cx),
def_id: cx.tcx.hir().local_def_id(self.id).to_def_id(),
visibility: self.vis.clean(cx),
stability: cx.stability(self.id).clean(cx),
stability: cx.stability(self.id),
deprecation: cx.deprecation(self.id).clean(cx),
inner: TypedefItem(Typedef { type_, generics: self.gen.clean(cx), item_type }, false),
}
Expand All @@ -2063,7 +2063,7 @@ impl Clean<Item> for doctree::OpaqueTy<'_> {
source: self.span.clean(cx),
def_id: cx.tcx.hir().local_def_id(self.id).to_def_id(),
visibility: self.vis.clean(cx),
stability: cx.stability(self.id).clean(cx),
stability: cx.stability(self.id),
deprecation: cx.deprecation(self.id).clean(cx),
inner: OpaqueTyItem(OpaqueTy {
bounds: self.opaque_ty.bounds.clean(cx),
Expand Down Expand Up @@ -2091,7 +2091,7 @@ impl Clean<Item> for doctree::Static<'_> {
source: self.span.clean(cx),
def_id: cx.tcx.hir().local_def_id(self.id).to_def_id(),
visibility: self.vis.clean(cx),
stability: cx.stability(self.id).clean(cx),
stability: cx.stability(self.id),
deprecation: cx.deprecation(self.id).clean(cx),
inner: StaticItem(Static {
type_: self.type_.clean(cx),
Expand All @@ -2112,7 +2112,7 @@ impl Clean<Item> for doctree::Constant<'_> {
source: self.span.clean(cx),
def_id: def_id.to_def_id(),
visibility: self.vis.clean(cx),
stability: cx.stability(self.id).clean(cx),
stability: cx.stability(self.id),
deprecation: cx.deprecation(self.id).clean(cx),
inner: ConstantItem(Constant {
type_: self.type_.clean(cx),
Expand Down Expand Up @@ -2166,7 +2166,7 @@ impl Clean<Vec<Item>> for doctree::Impl<'_> {
source: self.span.clean(cx),
def_id: def_id.to_def_id(),
visibility: self.vis.clean(cx),
stability: cx.stability(self.id).clean(cx),
stability: cx.stability(self.id),
deprecation: cx.deprecation(self.id).clean(cx),
inner: ImplItem(Impl {
unsafety: self.unsafety,
Expand Down Expand Up @@ -2348,7 +2348,7 @@ impl Clean<Item> for doctree::ForeignItem<'_> {
source: self.span.clean(cx),
def_id: cx.tcx.hir().local_def_id(self.id).to_def_id(),
visibility: self.vis.clean(cx),
stability: cx.stability(self.id).clean(cx),
stability: cx.stability(self.id),
deprecation: cx.deprecation(self.id).clean(cx),
inner,
}
Expand All @@ -2363,7 +2363,7 @@ impl Clean<Item> for doctree::Macro<'_> {
attrs: self.attrs.clean(cx),
source: self.span.clean(cx),
visibility: Public,
stability: cx.stability(self.hid).clean(cx),
stability: cx.stability(self.hid),
deprecation: cx.deprecation(self.hid).clean(cx),
def_id: self.def_id,
inner: MacroItem(Macro {
Expand All @@ -2388,20 +2388,14 @@ impl Clean<Item> for doctree::ProcMacro<'_> {
attrs: self.attrs.clean(cx),
source: self.span.clean(cx),
visibility: Public,
stability: cx.stability(self.id).clean(cx),
stability: cx.stability(self.id),
deprecation: cx.deprecation(self.id).clean(cx),
def_id: cx.tcx.hir().local_def_id(self.id).to_def_id(),
inner: ProcMacroItem(ProcMacro { kind: self.kind, helpers: self.helpers.clean(cx) }),
}
}
}

impl Clean<attr::Stability> for attr::Stability {
fn clean(&self, _: &DocContext<'_>) -> attr::Stability {
self.clone()
}
}

impl Clean<Deprecation> for attr::Deprecation {
fn clean(&self, _: &DocContext<'_>) -> Deprecation {
Deprecation {
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/clean/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ pub fn krate(mut cx: &mut DocContext<'_>) -> Crate {

// extract the stability index for a node from tcx, if possible
pub fn get_stability(cx: &DocContext<'_>, def_id: DefId) -> Option<Stability> {
cx.tcx.lookup_stability(def_id).clean(cx)
cx.tcx.lookup_stability(def_id).cloned()
}

pub fn get_deprecation(cx: &DocContext<'_>, def_id: DefId) -> Option<Deprecation> {
Expand Down

0 comments on commit 85c0479

Please sign in to comment.