Skip to content

Commit 32c8f7d

Browse files
committed
librustdoc: remove IndexItem::new, use previous fields constructor
Signed-off-by: xizheyin <[email protected]>
1 parent e89c849 commit 32c8f7d

File tree

2 files changed

+19
-51
lines changed

2 files changed

+19
-51
lines changed

src/librustdoc/formats/cache.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -574,20 +574,20 @@ fn add_item_to_search_index(tcx: TyCtxt<'_>, cache: &mut Cache, item: &clean::It
574574
);
575575
let aliases = item.attrs.get_doc_aliases();
576576
let deprecation = item.deprecation(tcx);
577-
let index_item = IndexItem::new(
578-
item.type_(),
579-
Some(defid),
577+
let index_item = IndexItem {
578+
ty: item.type_(),
579+
defid: Some(defid),
580580
name,
581581
path,
582582
desc,
583-
parent_did,
584-
None,
585-
None,
583+
parent: parent_did,
584+
parent_idx: None,
585+
exact_path: None,
586586
impl_id,
587587
search_type,
588588
aliases,
589589
deprecation,
590-
);
590+
};
591591
cache.search_index.push(index_item);
592592
}
593593

src/librustdoc/html/render/mod.rs

+12-44
Original file line numberDiff line numberDiff line change
@@ -113,50 +113,18 @@ enum RenderMode {
113113
/// by hand to a large JS file at the end of cache-creation.
114114
#[derive(Debug)]
115115
pub(crate) struct IndexItem {
116-
ty: ItemType,
117-
defid: Option<DefId>,
118-
name: Symbol,
119-
path: String,
120-
desc: String,
121-
parent: Option<DefId>,
122-
parent_idx: Option<isize>,
123-
exact_path: Option<String>,
124-
impl_id: Option<DefId>,
125-
search_type: Option<IndexItemFunctionType>,
126-
aliases: Box<[Symbol]>,
127-
deprecation: Option<Deprecation>,
128-
}
129-
130-
impl IndexItem {
131-
pub fn new(
132-
ty: ItemType,
133-
defid: Option<DefId>,
134-
name: Symbol,
135-
path: String,
136-
desc: String,
137-
parent: Option<DefId>,
138-
parent_idx: Option<isize>,
139-
exact_path: Option<String>,
140-
impl_id: Option<DefId>,
141-
search_type: Option<IndexItemFunctionType>,
142-
aliases: Box<[Symbol]>,
143-
deprecation: Option<Deprecation>,
144-
) -> Self {
145-
Self {
146-
ty,
147-
defid,
148-
name,
149-
path,
150-
desc,
151-
parent,
152-
parent_idx,
153-
exact_path,
154-
impl_id,
155-
search_type,
156-
aliases,
157-
deprecation,
158-
}
159-
}
116+
pub(crate) ty: ItemType,
117+
pub(crate) defid: Option<DefId>,
118+
pub(crate) name: Symbol,
119+
pub(crate) path: String,
120+
pub(crate) desc: String,
121+
pub(crate) parent: Option<DefId>,
122+
pub(crate) parent_idx: Option<isize>,
123+
pub(crate) exact_path: Option<String>,
124+
pub(crate) impl_id: Option<DefId>,
125+
pub(crate) search_type: Option<IndexItemFunctionType>,
126+
pub(crate) aliases: Box<[Symbol]>,
127+
pub(crate) deprecation: Option<Deprecation>,
160128
}
161129

162130
/// A type used for the search index.

0 commit comments

Comments
 (0)