Skip to content

Commit 750568d

Browse files
committed
Remove Clean impl for Option<T>
1 parent 120ef36 commit 750568d

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

src/librustdoc/clean/inline.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ crate fn build_impl(
448448
),
449449
};
450450
let polarity = tcx.impl_polarity(did);
451-
let trait_ = associated_trait.clean(cx);
451+
let trait_ = associated_trait.map(|t| t.clean(cx));
452452
if trait_.as_ref().map(|t| t.def_id()) == tcx.lang_items().deref_trait() {
453453
super::build_deref_target_impls(cx, &trait_items, ret);
454454
}

src/librustdoc/clean/mod.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,6 @@ impl<T: Clean<U>, U> Clean<U> for Rc<T> {
8080
}
8181
}
8282

83-
impl<T: Clean<U>, U> Clean<Option<U>> for Option<T> {
84-
fn clean(&self, cx: &mut DocContext<'_>) -> Option<U> {
85-
self.as_ref().map(|v| v.clean(cx))
86-
}
87-
}
88-
8983
impl Clean<Item> for doctree::Module<'_> {
9084
fn clean(&self, cx: &mut DocContext<'_>) -> Item {
9185
let mut items: Vec<Item> = vec![];
@@ -460,7 +454,7 @@ impl Clean<GenericParamDef> for hir::GenericParam<'_> {
460454
GenericParamDefKind::Type {
461455
did: cx.tcx.hir().local_def_id(self.hir_id).to_def_id(),
462456
bounds: self.bounds.clean(cx),
463-
default: default.clean(cx).map(Box::new),
457+
default: default.map(|t| t.clean(cx)).map(Box::new),
464458
synthetic,
465459
},
466460
),
@@ -935,7 +929,7 @@ impl Clean<Item> for hir::TraitItem<'_> {
935929
TyMethodItem(t)
936930
}
937931
hir::TraitItemKind::Type(bounds, ref default) => {
938-
AssocTypeItem(bounds.clean(cx), default.clean(cx))
932+
AssocTypeItem(bounds.clean(cx), default.map(|t| t.clean(cx)))
939933
}
940934
};
941935
let what_rustc_thinks =
@@ -1127,7 +1121,7 @@ impl Clean<Item> for ty::AssocItem {
11271121
None
11281122
};
11291123

1130-
AssocTypeItem(bounds, ty.clean(cx))
1124+
AssocTypeItem(bounds, ty.map(|t| t.clean(cx)))
11311125
} else {
11321126
// FIXME: when could this happen? Associated items in inherent impls?
11331127
let type_ = tcx.type_of(self.def_id).clean(cx);
@@ -1859,7 +1853,7 @@ impl Clean<Item> for hir::Variant<'_> {
18591853
fn clean_impl(impl_: &hir::Impl<'_>, hir_id: hir::HirId, cx: &mut DocContext<'_>) -> Vec<Item> {
18601854
let tcx = cx.tcx;
18611855
let mut ret = Vec::new();
1862-
let trait_ = impl_.of_trait.clean(cx);
1856+
let trait_ = impl_.of_trait.as_ref().map(|t| t.clean(cx));
18631857
let items =
18641858
impl_.items.iter().map(|ii| tcx.hir().impl_item(ii.id).clean(cx)).collect::<Vec<_>>();
18651859
let def_id = tcx.hir().local_def_id(hir_id);

0 commit comments

Comments
 (0)