rustdoc: Remove redundant Impl.span
field
It can be computed on-demand in `Item::span()`.
This commit is contained in:
parent
88b4ea8fb6
commit
c32ee54380
6 changed files with 13 additions and 12 deletions
|
@ -115,7 +115,6 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
|
||||||
visibility: Inherited,
|
visibility: Inherited,
|
||||||
def_id: ItemId::Auto { trait_: trait_def_id, for_: item_def_id },
|
def_id: ItemId::Auto { trait_: trait_def_id, for_: item_def_id },
|
||||||
kind: box ImplItem(Impl {
|
kind: box ImplItem(Impl {
|
||||||
span: Span::dummy(),
|
|
||||||
unsafety: hir::Unsafety::Normal,
|
unsafety: hir::Unsafety::Normal,
|
||||||
generics: new_generics,
|
generics: new_generics,
|
||||||
trait_: Some(trait_ref.clean(self.cx)),
|
trait_: Some(trait_ref.clean(self.cx)),
|
||||||
|
|
|
@ -106,7 +106,6 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
|
||||||
visibility: Inherited,
|
visibility: Inherited,
|
||||||
def_id: ItemId::Blanket { impl_id: impl_def_id, for_: item_def_id },
|
def_id: ItemId::Blanket { impl_id: impl_def_id, for_: item_def_id },
|
||||||
kind: box ImplItem(Impl {
|
kind: box ImplItem(Impl {
|
||||||
span: Span::new(self.cx.tcx.def_span(impl_def_id)),
|
|
||||||
unsafety: hir::Unsafety::Normal,
|
unsafety: hir::Unsafety::Normal,
|
||||||
generics: (
|
generics: (
|
||||||
self.cx.tcx.generics_of(impl_def_id),
|
self.cx.tcx.generics_of(impl_def_id),
|
||||||
|
|
|
@ -490,7 +490,6 @@ crate fn build_impl(
|
||||||
did,
|
did,
|
||||||
None,
|
None,
|
||||||
clean::ImplItem(clean::Impl {
|
clean::ImplItem(clean::Impl {
|
||||||
span: clean::types::rustc_span(did, cx.tcx),
|
|
||||||
unsafety: hir::Unsafety::Normal,
|
unsafety: hir::Unsafety::Normal,
|
||||||
generics,
|
generics,
|
||||||
trait_,
|
trait_,
|
||||||
|
|
|
@ -1889,7 +1889,6 @@ fn clean_impl(impl_: &hir::Impl<'_>, hir_id: hir::HirId, cx: &mut DocContext<'_>
|
||||||
});
|
});
|
||||||
let mut make_item = |trait_: Option<Path>, for_: Type, items: Vec<Item>| {
|
let mut make_item = |trait_: Option<Path>, for_: Type, items: Vec<Item>| {
|
||||||
let kind = ImplItem(Impl {
|
let kind = ImplItem(Impl {
|
||||||
span: types::rustc_span(tcx.hir().local_def_id(hir_id).to_def_id(), tcx),
|
|
||||||
unsafety: impl_.unsafety,
|
unsafety: impl_.unsafety,
|
||||||
generics: impl_.generics.clean(cx),
|
generics: impl_.generics.clean(cx),
|
||||||
trait_,
|
trait_,
|
||||||
|
|
|
@ -391,12 +391,19 @@ impl Item {
|
||||||
ItemKind::StrippedItem(k) => k,
|
ItemKind::StrippedItem(k) => k,
|
||||||
_ => &*self.kind,
|
_ => &*self.kind,
|
||||||
};
|
};
|
||||||
if let ItemKind::ModuleItem(Module { span, .. }) | ItemKind::ImplItem(Impl { span, .. }) =
|
match kind {
|
||||||
kind
|
ItemKind::ModuleItem(Module { span, .. }) => *span,
|
||||||
{
|
ItemKind::ImplItem(Impl { synthetic: true, .. }) => Span::dummy(),
|
||||||
*span
|
ItemKind::ImplItem(Impl { blanket_impl: Some(_), .. }) => {
|
||||||
} else {
|
if let ItemId::Blanket { impl_id, .. } = self.def_id {
|
||||||
self.def_id.as_def_id().map(|did| rustc_span(did, tcx)).unwrap_or_else(Span::dummy)
|
rustc_span(impl_id, tcx)
|
||||||
|
} else {
|
||||||
|
panic!("blanket impl item has non-blanket ID")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => {
|
||||||
|
self.def_id.as_def_id().map(|did| rustc_span(did, tcx)).unwrap_or_else(Span::dummy)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2165,7 +2172,6 @@ impl Constant {
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
crate struct Impl {
|
crate struct Impl {
|
||||||
crate span: Span,
|
|
||||||
crate unsafety: hir::Unsafety,
|
crate unsafety: hir::Unsafety,
|
||||||
crate generics: Generics,
|
crate generics: Generics,
|
||||||
crate trait_: Option<Path>,
|
crate trait_: Option<Path>,
|
||||||
|
|
|
@ -509,7 +509,6 @@ impl FromWithTcx<clean::Impl> for Impl {
|
||||||
negative_polarity,
|
negative_polarity,
|
||||||
synthetic,
|
synthetic,
|
||||||
blanket_impl,
|
blanket_impl,
|
||||||
span: _span,
|
|
||||||
} = impl_;
|
} = impl_;
|
||||||
// FIXME: should `trait_` be a clean::Path equivalent in JSON?
|
// FIXME: should `trait_` be a clean::Path equivalent in JSON?
|
||||||
let trait_ = trait_.map(|path| {
|
let trait_ = trait_.map(|path| {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue