Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustdoc: remove dead code in clean #86887

Merged
merged 2 commits into from
Jul 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/librustdoc/clean/blanket_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
visibility: Inherited,
def_id: FakeDefId::new_fake(item_def_id.krate),
kind: box ImplItem(Impl {
span: self.cx.tcx.def_span(impl_def_id).clean(self.cx),
span: Span::from_rustc_span(self.cx.tcx.def_span(impl_def_id)),
unsafety: hir::Unsafety::Normal,
generics: (
self.cx.tcx.generics_of(impl_def_id),
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/clean/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ fn build_macro(cx: &mut DocContext<'_>, did: DefId, name: Symbol) -> clean::Item

let source = format!(
"macro_rules! {} {{\n{}}}",
name.clean(cx),
name,
utils::render_macro_arms(matchers, ";")
);

Expand Down
59 changes: 0 additions & 59 deletions src/librustdoc/clean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,20 +227,6 @@ impl<'tcx> Clean<GenericBound> for ty::PolyTraitRef<'tcx> {
}
}

impl<'tcx> Clean<Option<Vec<GenericBound>>> for InternalSubsts<'tcx> {
fn clean(&self, cx: &mut DocContext<'_>) -> Option<Vec<GenericBound>> {
let mut v = Vec::new();
v.extend(self.regions().filter_map(|r| r.clean(cx)).map(GenericBound::Outlives));
v.extend(self.types().map(|t| {
GenericBound::TraitBound(
PolyTrait { trait_: t.clean(cx), generic_params: Vec::new() },
hir::TraitBoundModifier::None,
)
}));
if !v.is_empty() { Some(v) } else { None }
}
}

impl Clean<Lifetime> for hir::Lifetime {
fn clean(&self, cx: &mut DocContext<'_>) -> Lifetime {
let def = cx.tcx.named_region(self.hir_id);
Expand Down Expand Up @@ -296,12 +282,6 @@ impl Clean<Constant> for hir::ConstArg {
}
}

impl Clean<Lifetime> for ty::GenericParamDef {
fn clean(&self, _cx: &mut DocContext<'_>) -> Lifetime {
Lifetime(self.name)
}
}

impl Clean<Option<Lifetime>> for ty::RegionKind {
fn clean(&self, _cx: &mut DocContext<'_>) -> Option<Lifetime> {
match *self {
Expand Down Expand Up @@ -1764,12 +1744,6 @@ impl Clean<Variant> for hir::VariantData<'_> {
}
}

impl Clean<Span> for rustc_span::Span {
fn clean(&self, _cx: &mut DocContext<'_>) -> Span {
Span::from_rustc_span(*self)
}
}

impl Clean<Path> for hir::Path<'_> {
fn clean(&self, cx: &mut DocContext<'_>) -> Path {
Path {
Expand Down Expand Up @@ -1814,20 +1788,6 @@ impl Clean<PathSegment> for hir::PathSegment<'_> {
}
}

impl Clean<String> for Ident {
#[inline]
fn clean(&self, cx: &mut DocContext<'_>) -> String {
self.name.clean(cx)
}
}

impl Clean<String> for Symbol {
#[inline]
fn clean(&self, _: &mut DocContext<'_>) -> String {
self.to_string()
}
}

impl Clean<BareFunctionDecl> for hir::BareFnTy<'_> {
fn clean(&self, cx: &mut DocContext<'_>) -> BareFunctionDecl {
let (generic_params, decl) = enter_impl_trait(cx, |cx| {
Expand Down Expand Up @@ -2225,22 +2185,3 @@ impl Clean<TypeBindingKind> for hir::TypeBindingKind<'_> {
}
}
}

enum SimpleBound {
TraitBound(Vec<PathSegment>, Vec<SimpleBound>, Vec<GenericParamDef>, hir::TraitBoundModifier),
Outlives(Lifetime),
}

impl From<GenericBound> for SimpleBound {
fn from(bound: GenericBound) -> Self {
match bound.clone() {
GenericBound::Outlives(l) => SimpleBound::Outlives(l),
GenericBound::TraitBound(t, mod_) => match t.trait_ {
Type::ResolvedPath { path, .. } => {
SimpleBound::TraitBound(path.segments, Vec::new(), t.generic_params, mod_)
}
_ => panic!("Unexpected bound {:?}", bound),
},
}
}
}