about summary refs log tree commit diff
path: root/src/librustdoc/html/render/mod.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-05-30 08:55:18 +0000
committerbors <bors@rust-lang.org>2025-05-30 08:55:18 +0000
commite6152cdf5b31bd844a4cc1049433859d54863602 (patch)
treea082c70e06369cfc7db5733bc9ced96b0aad75da /src/librustdoc/html/render/mod.rs
parent6de3a733122a82d9b3c3427c7ee16a1e1a022718 (diff)
parent68f32169e59dd8bde8fd66cc4ffe98cd24ac09ca (diff)
downloadrust-e6152cdf5b31bd844a4cc1049433859d54863602.tar.gz
rust-e6152cdf5b31bd844a4cc1049433859d54863602.zip
Auto merge of #141573 - nnethercote:rustdoc-alloc-cleanups, r=camelid
rustdoc: cleanups relating to allocations

These commits generally clean up the code a bit and also reduce allocation rates a bit.

r? `@camelid`
Diffstat (limited to 'src/librustdoc/html/render/mod.rs')
-rw-r--r--src/librustdoc/html/render/mod.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs
index 5677b13033d..66d5aafa3c1 100644
--- a/src/librustdoc/html/render/mod.rs
+++ b/src/librustdoc/html/render/mod.rs
@@ -2548,7 +2548,7 @@ fn item_ty_to_section(ty: ItemType) -> ItemSection {
 /// types are re-exported, we don't use the corresponding
 /// entry from the js file, as inlining will have already
 /// picked up the impl
-fn collect_paths_for_type(first_ty: clean::Type, cache: &Cache) -> Vec<String> {
+fn collect_paths_for_type(first_ty: &clean::Type, cache: &Cache) -> Vec<String> {
     let mut out = Vec::new();
     let mut visited = FxHashSet::default();
     let mut work = VecDeque::new();
@@ -2565,7 +2565,7 @@ fn collect_paths_for_type(first_ty: clean::Type, cache: &Cache) -> Vec<String> {
     work.push_back(first_ty);
 
     while let Some(ty) = work.pop_front() {
-        if !visited.insert(ty.clone()) {
+        if !visited.insert(ty) {
             continue;
         }
 
@@ -2575,16 +2575,16 @@ fn collect_paths_for_type(first_ty: clean::Type, cache: &Cache) -> Vec<String> {
                 work.extend(tys.into_iter());
             }
             clean::Type::Slice(ty) => {
-                work.push_back(*ty);
+                work.push_back(ty);
             }
             clean::Type::Array(ty, _) => {
-                work.push_back(*ty);
+                work.push_back(ty);
             }
             clean::Type::RawPointer(_, ty) => {
-                work.push_back(*ty);
+                work.push_back(ty);
             }
             clean::Type::BorrowedRef { type_, .. } => {
-                work.push_back(*type_);
+                work.push_back(type_);
             }
             clean::Type::QPath(box clean::QPathData { self_type, trait_, .. }) => {
                 work.push_back(self_type);