From d91946b3f4ea04bc205b5796fc4af0f13069d204 Mon Sep 17 00:00:00 2001 From: Noah Lev Date: Sun, 22 Aug 2021 18:11:16 -0700 Subject: [PATCH] Remove `Path.global` --- src/librustdoc/clean/inline.rs | 1 - src/librustdoc/clean/mod.rs | 7 +------ src/librustdoc/clean/types.rs | 4 +--- src/librustdoc/clean/utils.rs | 3 +-- 4 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index 4a888b22332..daff902aaa5 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -526,7 +526,6 @@ fn build_module( item.ident.name, clean::ImportSource { path: clean::Path { - global: false, res, segments: vec![clean::PathSegment { name: prim_ty.as_sym(), diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 49fc93f3fea..a7960807f4c 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1277,7 +1277,6 @@ fn clean_qpath(hir_ty: &hir::Ty<'_>, cx: &mut DocContext<'_>) -> Type { let trait_segments = &segments[..segments.len() - 1]; let trait_def = cx.tcx.associated_item(p.res.def_id()).container.id(); let trait_path = self::Path { - global: p.is_global(), res: Res::Def(DefKind::Trait, trait_def), segments: trait_segments.clean(cx), }; @@ -1728,11 +1727,7 @@ impl Clean for hir::VariantData<'_> { impl Clean for hir::Path<'_> { fn clean(&self, cx: &mut DocContext<'_>) -> Path { - Path { - global: self.is_global(), - res: self.res, - segments: if self.is_global() { &self.segments[1..] } else { &self.segments }.clean(cx), - } + Path { res: self.res, segments: self.segments.clean(cx) } } } diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index 248ff339514..7b0d331045c 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -1967,7 +1967,6 @@ impl Span { #[derive(Clone, PartialEq, Eq, Debug, Hash)] crate struct Path { - crate global: bool, crate res: Res, crate segments: Vec, } @@ -1982,8 +1981,7 @@ impl Path { } crate fn whole_name(&self) -> String { - String::from(if self.global { "::" } else { "" }) - + &self.segments.iter().map(|s| s.name.to_string()).collect::>().join("::") + self.segments.iter().map(|s| s.name.to_string()).collect::>().join("::") } /// Checks if this is a `T::Name` path for an associated type. diff --git a/src/librustdoc/clean/utils.rs b/src/librustdoc/clean/utils.rs index 33d460d587a..55dfa2711db 100644 --- a/src/librustdoc/clean/utils.rs +++ b/src/librustdoc/clean/utils.rs @@ -148,7 +148,6 @@ pub(super) fn external_path( let def_kind = cx.tcx.def_kind(did); let name = cx.tcx.item_name(did); Path { - global: false, res: Res::Def(def_kind, did), segments: vec![PathSegment { name, @@ -199,7 +198,7 @@ crate fn strip_path(path: &Path) -> Path { }) .collect(); - Path { global: path.global, res: path.res, segments } + Path { res: path.res, segments } } crate fn qpath_to_string(p: &hir::QPath<'_>) -> String {