Fix implementation of clean::Path::whole_name()

I think that before this commit, the path `::std::vec::Vec` would have
rendered as `{{root}}::std::vec::Vec`. Now, it should render correctly
as `::std::vec::Vec`.
This commit is contained in:
Noah Lev 2021-10-03 12:40:53 -07:00
parent f359b316df
commit ebbcafbfa3

View File

@ -1958,7 +1958,11 @@ impl Path {
}
crate fn whole_name(&self) -> String {
self.segments.iter().map(|s| s.name.to_string()).intersperse("::".into()).collect()
self.segments
.iter()
.map(|s| if s.name == kw::PathRoot { String::new() } else { s.name.to_string() })
.intersperse("::".into())
.collect()
}
/// Checks if this is a `T::Name` path for an associated type.