Skip to content

Commit 0d5bdca

Browse files
authored
Rollup merge of rust-lang#99775 - notriddle:notriddle/as-str, r=camelid
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.
2 parents f8f07de + b8fb6e1 commit 0d5bdca

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/librustdoc/clean/types.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2175,8 +2175,8 @@ impl Path {
21752175
pub(crate) fn whole_name(&self) -> String {
21762176
self.segments
21772177
.iter()
2178-
.map(|s| if s.name == kw::PathRoot { String::new() } else { s.name.to_string() })
2179-
.intersperse("::".into())
2178+
.map(|s| if s.name == kw::PathRoot { "" } else { s.name.as_str() })
2179+
.intersperse("::")
21802180
.collect()
21812181
}
21822182

0 commit comments

Comments
 (0)