Remove Path.global
This commit is contained in:
parent
6dc08b909b
commit
d91946b3f4
4 changed files with 3 additions and 12 deletions
|
@ -526,7 +526,6 @@ fn build_module(
|
||||||
item.ident.name,
|
item.ident.name,
|
||||||
clean::ImportSource {
|
clean::ImportSource {
|
||||||
path: clean::Path {
|
path: clean::Path {
|
||||||
global: false,
|
|
||||||
res,
|
res,
|
||||||
segments: vec![clean::PathSegment {
|
segments: vec![clean::PathSegment {
|
||||||
name: prim_ty.as_sym(),
|
name: prim_ty.as_sym(),
|
||||||
|
|
|
@ -1277,7 +1277,6 @@ fn clean_qpath(hir_ty: &hir::Ty<'_>, cx: &mut DocContext<'_>) -> Type {
|
||||||
let trait_segments = &segments[..segments.len() - 1];
|
let trait_segments = &segments[..segments.len() - 1];
|
||||||
let trait_def = cx.tcx.associated_item(p.res.def_id()).container.id();
|
let trait_def = cx.tcx.associated_item(p.res.def_id()).container.id();
|
||||||
let trait_path = self::Path {
|
let trait_path = self::Path {
|
||||||
global: p.is_global(),
|
|
||||||
res: Res::Def(DefKind::Trait, trait_def),
|
res: Res::Def(DefKind::Trait, trait_def),
|
||||||
segments: trait_segments.clean(cx),
|
segments: trait_segments.clean(cx),
|
||||||
};
|
};
|
||||||
|
@ -1728,11 +1727,7 @@ impl Clean<Variant> for hir::VariantData<'_> {
|
||||||
|
|
||||||
impl Clean<Path> for hir::Path<'_> {
|
impl Clean<Path> for hir::Path<'_> {
|
||||||
fn clean(&self, cx: &mut DocContext<'_>) -> Path {
|
fn clean(&self, cx: &mut DocContext<'_>) -> Path {
|
||||||
Path {
|
Path { res: self.res, segments: self.segments.clean(cx) }
|
||||||
global: self.is_global(),
|
|
||||||
res: self.res,
|
|
||||||
segments: if self.is_global() { &self.segments[1..] } else { &self.segments }.clean(cx),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1967,7 +1967,6 @@ impl Span {
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
|
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
|
||||||
crate struct Path {
|
crate struct Path {
|
||||||
crate global: bool,
|
|
||||||
crate res: Res,
|
crate res: Res,
|
||||||
crate segments: Vec<PathSegment>,
|
crate segments: Vec<PathSegment>,
|
||||||
}
|
}
|
||||||
|
@ -1982,8 +1981,7 @@ impl Path {
|
||||||
}
|
}
|
||||||
|
|
||||||
crate fn whole_name(&self) -> String {
|
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.
|
/// Checks if this is a `T::Name` path for an associated type.
|
||||||
|
|
|
@ -148,7 +148,6 @@ pub(super) fn external_path(
|
||||||
let def_kind = cx.tcx.def_kind(did);
|
let def_kind = cx.tcx.def_kind(did);
|
||||||
let name = cx.tcx.item_name(did);
|
let name = cx.tcx.item_name(did);
|
||||||
Path {
|
Path {
|
||||||
global: false,
|
|
||||||
res: Res::Def(def_kind, did),
|
res: Res::Def(def_kind, did),
|
||||||
segments: vec![PathSegment {
|
segments: vec![PathSegment {
|
||||||
name,
|
name,
|
||||||
|
@ -199,7 +198,7 @@ crate fn strip_path(path: &Path) -> Path {
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
Path { global: path.global, res: path.res, segments }
|
Path { res: path.res, segments }
|
||||||
}
|
}
|
||||||
|
|
||||||
crate fn qpath_to_string(p: &hir::QPath<'_>) -> String {
|
crate fn qpath_to_string(p: &hir::QPath<'_>) -> String {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue