about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorxizheyin <xizheyin@smail.nju.edu.cn>2025-04-09 20:51:52 +0800
committerxizheyin <xizheyin@smail.nju.edu.cn>2025-04-09 20:51:52 +0800
commit32c8f7dbcf17e8a97a3a99e112e86a604d12f0a2 (patch)
treee1f5757960a870cfefcbbf286db5f807c5319eb2 /src
parente89c84913690bad837b658ade502cb0af7df768b (diff)
downloadrust-32c8f7dbcf17e8a97a3a99e112e86a604d12f0a2.tar.gz
rust-32c8f7dbcf17e8a97a3a99e112e86a604d12f0a2.zip
librustdoc: remove IndexItem::new, use previous fields constructor
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/formats/cache.rs14
-rw-r--r--src/librustdoc/html/render/mod.rs56
2 files changed, 19 insertions, 51 deletions
diff --git a/src/librustdoc/formats/cache.rs b/src/librustdoc/formats/cache.rs
index 2a612fa9b8c..2648641e53e 100644
--- a/src/librustdoc/formats/cache.rs
+++ b/src/librustdoc/formats/cache.rs
@@ -574,20 +574,20 @@ fn add_item_to_search_index(tcx: TyCtxt<'_>, cache: &mut Cache, item: &clean::It
     );
     let aliases = item.attrs.get_doc_aliases();
     let deprecation = item.deprecation(tcx);
-    let index_item = IndexItem::new(
-        item.type_(),
-        Some(defid),
+    let index_item = IndexItem {
+        ty: item.type_(),
+        defid: Some(defid),
         name,
         path,
         desc,
-        parent_did,
-        None,
-        None,
+        parent: parent_did,
+        parent_idx: None,
+        exact_path: None,
         impl_id,
         search_type,
         aliases,
         deprecation,
-    );
+    };
     cache.search_index.push(index_item);
 }
 
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs
index b9a2e65b090..ad6fa110ae8 100644
--- a/src/librustdoc/html/render/mod.rs
+++ b/src/librustdoc/html/render/mod.rs
@@ -113,50 +113,18 @@ enum RenderMode {
 /// by hand to a large JS file at the end of cache-creation.
 #[derive(Debug)]
 pub(crate) struct IndexItem {
-    ty: ItemType,
-    defid: Option<DefId>,
-    name: Symbol,
-    path: String,
-    desc: String,
-    parent: Option<DefId>,
-    parent_idx: Option<isize>,
-    exact_path: Option<String>,
-    impl_id: Option<DefId>,
-    search_type: Option<IndexItemFunctionType>,
-    aliases: Box<[Symbol]>,
-    deprecation: Option<Deprecation>,
-}
-
-impl IndexItem {
-    pub fn new(
-        ty: ItemType,
-        defid: Option<DefId>,
-        name: Symbol,
-        path: String,
-        desc: String,
-        parent: Option<DefId>,
-        parent_idx: Option<isize>,
-        exact_path: Option<String>,
-        impl_id: Option<DefId>,
-        search_type: Option<IndexItemFunctionType>,
-        aliases: Box<[Symbol]>,
-        deprecation: Option<Deprecation>,
-    ) -> Self {
-        Self {
-            ty,
-            defid,
-            name,
-            path,
-            desc,
-            parent,
-            parent_idx,
-            exact_path,
-            impl_id,
-            search_type,
-            aliases,
-            deprecation,
-        }
-    }
+    pub(crate) ty: ItemType,
+    pub(crate) defid: Option<DefId>,
+    pub(crate) name: Symbol,
+    pub(crate) path: String,
+    pub(crate) desc: String,
+    pub(crate) parent: Option<DefId>,
+    pub(crate) parent_idx: Option<isize>,
+    pub(crate) exact_path: Option<String>,
+    pub(crate) impl_id: Option<DefId>,
+    pub(crate) search_type: Option<IndexItemFunctionType>,
+    pub(crate) aliases: Box<[Symbol]>,
+    pub(crate) deprecation: Option<Deprecation>,
 }
 
 /// A type used for the search index.