1
Fork 0

Remove Path.global

This commit is contained in:
Noah Lev 2021-08-22 18:11:16 -07:00
parent 6dc08b909b
commit d91946b3f4
4 changed files with 3 additions and 12 deletions

View file

@ -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(),

View file

@ -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<Variant> for hir::VariantData<'_> {
impl Clean<Path> 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) }
}
}

View file

@ -1967,7 +1967,6 @@ impl Span {
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
crate struct Path {
crate global: bool,
crate res: Res,
crate segments: Vec<PathSegment>,
}
@ -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::<Vec<_>>().join("::")
self.segments.iter().map(|s| s.name.to_string()).collect::<Vec<_>>().join("::")
}
/// Checks if this is a `T::Name` path for an associated type.

View file

@ -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 {