diff options
| author | Michael Howell <michael@notriddle.com> | 2022-07-26 12:23:59 -0700 |
|---|---|---|
| committer | Michael Howell <michael@notriddle.com> | 2022-07-26 12:23:59 -0700 |
| commit | b8fb6e103294f8a6028122df2650fff84f2e3e14 (patch) | |
| tree | 89501f836f9f5aa45274ac5595a84cc12dd75ab6 /src/librustdoc/clean | |
| parent | c9b31839b624345d59fda6e595b9abae71fcea13 (diff) | |
| download | rust-b8fb6e103294f8a6028122df2650fff84f2e3e14.tar.gz rust-b8fb6e103294f8a6028122df2650fff84f2e3e14.zip | |
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.
Diffstat (limited to 'src/librustdoc/clean')
| -rw-r--r-- | src/librustdoc/clean/types.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index 2d364f3402e..83d8ed3fc87 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -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() } |
