Skip to content

Commit

Permalink
Rollup merge of #99775 - notriddle:notriddle/as-str, r=camelid
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
JohnTitor authored Jul 27, 2022
2 parents f8f07de + b8fb6e1 commit 0d5bdca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/librustdoc/clean/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down

0 comments on commit 0d5bdca

Please sign in to comment.