Skip to content

Commit 2fda7d4

Browse files
committed
Rollup merge of rust-lang#34105 - ollie27:rustdoc_derived, r=alexcrichton
rustdoc: Remove Derived Implementations title As far as I know whether a trait was derived or not does not change the public API so there is no need to include this information in the docs. This title currently just adds an extra divide in the list of trait implementations which I don't think needs to be there.
2 parents ea0dc92 + cc18104 commit 2fda7d4

File tree

3 files changed

+1
-23
lines changed

3 files changed

+1
-23
lines changed

src/librustdoc/clean/inline.rs

-1
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,6 @@ pub fn build_impl<'a, 'tcx>(cx: &DocContext,
432432
ret.push(clean::Item {
433433
inner: clean::ImplItem(clean::Impl {
434434
unsafety: hir::Unsafety::Normal, // FIXME: this should be decoded
435-
derived: clean::detect_derived(&attrs),
436435
provided_trait_methods: provided,
437436
trait_: trait_,
438437
for_: for_,

src/librustdoc/clean/mod.rs

-6
Original file line numberDiff line numberDiff line change
@@ -2239,14 +2239,9 @@ pub struct Impl {
22392239
pub trait_: Option<Type>,
22402240
pub for_: Type,
22412241
pub items: Vec<Item>,
2242-
pub derived: bool,
22432242
pub polarity: Option<ImplPolarity>,
22442243
}
22452244

2246-
fn detect_derived<M: AttrMetaMethods>(attrs: &[M]) -> bool {
2247-
attr::contains_name(attrs, "automatically_derived")
2248-
}
2249-
22502245
impl Clean<Vec<Item>> for doctree::Impl {
22512246
fn clean(&self, cx: &DocContext) -> Vec<Item> {
22522247
let mut ret = Vec::new();
@@ -2283,7 +2278,6 @@ impl Clean<Vec<Item>> for doctree::Impl {
22832278
trait_: trait_,
22842279
for_: self.for_.clean(cx),
22852280
items: items,
2286-
derived: detect_derived(&self.attrs),
22872281
polarity: Some(self.polarity.clean(cx)),
22882282
}),
22892283
});

src/librustdoc/html/render.rs

+1-16
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,6 @@ fn init_ids() -> HashMap<String, usize> {
399399
"methods",
400400
"deref-methods",
401401
"implementations",
402-
"derived_implementations"
403402
].into_iter().map(|id| (String::from(*id), 1)).collect()
404403
}
405404

@@ -2524,25 +2523,11 @@ fn render_assoc_items(w: &mut fmt::Formatter,
25242523
}
25252524
write!(w, "<h2 id='implementations'>Trait \
25262525
Implementations</h2>")?;
2527-
let (derived, manual): (Vec<_>, Vec<&Impl>) = traits.iter().partition(|i| {
2528-
i.inner_impl().derived
2529-
});
2530-
for i in &manual {
2526+
for i in &traits {
25312527
let did = i.trait_did().unwrap();
25322528
let assoc_link = AssocItemLink::GotoSource(did, &i.inner_impl().provided_trait_methods);
25332529
render_impl(w, cx, i, assoc_link, true, containing_item.stable_since())?;
25342530
}
2535-
if !derived.is_empty() {
2536-
write!(w, "<h3 id='derived_implementations'>\
2537-
Derived Implementations \
2538-
</h3>")?;
2539-
for i in &derived {
2540-
let did = i.trait_did().unwrap();
2541-
let assoc_link = AssocItemLink::GotoSource(did,
2542-
&i.inner_impl().provided_trait_methods);
2543-
render_impl(w, cx, i, assoc_link, true, containing_item.stable_since())?;
2544-
}
2545-
}
25462531
}
25472532
Ok(())
25482533
}

0 commit comments

Comments
 (0)