mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
rustdoc: do not allocate String when writing path full name
No idea if this makes any perf difference, but it just seems like premature pessimisation to use String when str will do.
This commit is contained in:
parent
c9b31839b6
commit
b8fb6e1032
@ -2175,8 +2175,8 @@ impl Path {
|
||||
pub(crate) fn whole_name(&self) -> String {
|
||||
self.segments
|
||||
.iter()
|
||||
.map(|s| if s.name == kw::PathRoot { String::new() } else { s.name.to_string() })
|
||||
.intersperse("::".into())
|
||||
.map(|s| if s.name == kw::PathRoot { "" } else { s.name.as_str() })
|
||||
.intersperse("::")
|
||||
.collect()
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user