Remove trival impl Clean for CrateNum

This commit is contained in:
Joshua Nelson 2021-07-05 12:36:32 -04:00
parent e32eceefe1
commit a30fa08928
3 changed files with 4 additions and 10 deletions

View File

@ -14,7 +14,7 @@ use rustc_attr as attr;
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_hir as hir;
use rustc_hir::def::{CtorKind, DefKind, Res};
use rustc_hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE};
use rustc_hir::def_id::{DefId, CRATE_DEF_INDEX, LOCAL_CRATE};
use rustc_index::vec::{Idx, IndexVec};
use rustc_infer::infer::region_constraints::{Constraint, RegionConstraintData};
use rustc_middle::middle::resolve_lifetime as rl;
@ -85,12 +85,6 @@ impl<T: Clean<U>, U> Clean<Option<U>> for Option<T> {
}
}
impl Clean<ExternalCrate> for CrateNum {
fn clean(&self, _cx: &mut DocContext<'_>) -> ExternalCrate {
ExternalCrate { crate_num: *self }
}
}
impl Clean<Item> for doctree::Module<'_> {
fn clean(&self, cx: &mut DocContext<'_>) -> Item {
let mut items: Vec<Item> = vec![];

View File

@ -133,7 +133,7 @@ crate struct TraitWithExtraInfo {
crate is_notable: bool,
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
#[derive(Copy, Clone, Debug)]
crate struct ExternalCrate {
crate crate_num: CrateNum,
}

View File

@ -39,7 +39,7 @@ crate fn krate(cx: &mut DocContext<'_>) -> Crate {
// Analyze doc-reachability for extern items
LibEmbargoVisitor::new(cx).visit_lib(cnum);
}
externs.sort_unstable();
externs.sort_unstable_by_key(|e| e.crate_num);
// Clean the crate, translating the entire librustc_ast AST to one that is
// understood by rustdoc.
@ -61,7 +61,7 @@ crate fn krate(cx: &mut DocContext<'_>) -> Crate {
_ => unreachable!(),
}
let local_crate = LOCAL_CRATE.clean(cx);
let local_crate = ExternalCrate { crate_num: LOCAL_CRATE };
let src = local_crate.src(cx.tcx);
let name = local_crate.name(cx.tcx);
let primitives = local_crate.primitives(cx.tcx);