Skip to content

Commit a654216

Browse files
committed
rustdoc: Record aliases as Symbols
1 parent 8b8f1e0 commit a654216

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/librustdoc/clean/types.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,24 +1114,24 @@ impl Attributes {
11141114
if self.doc_strings.is_empty() { None } else { Some(self.doc_strings.iter().collect()) }
11151115
}
11161116

1117-
crate fn get_doc_aliases(&self) -> Box<[String]> {
1117+
crate fn get_doc_aliases(&self) -> Box<[Symbol]> {
11181118
let mut aliases = FxHashSet::default();
11191119

11201120
for attr in self.other_attrs.lists(sym::doc).filter(|a| a.has_name(sym::alias)) {
11211121
if let Some(values) = attr.meta_item_list() {
11221122
for l in values {
11231123
match l.literal().unwrap().kind {
11241124
ast::LitKind::Str(s, _) => {
1125-
aliases.insert(s.as_str().to_string());
1125+
aliases.insert(s);
11261126
}
11271127
_ => unreachable!(),
11281128
}
11291129
}
11301130
} else {
1131-
aliases.insert(attr.value_str().map(|s| s.to_string()).unwrap());
1131+
aliases.insert(attr.value_str().unwrap());
11321132
}
11331133
}
1134-
aliases.into_iter().collect::<Vec<String>>().into()
1134+
aliases.into_iter().collect::<Vec<_>>().into()
11351135
}
11361136
}
11371137

src/librustdoc/html/render/cache.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ crate fn build_index<'tcx>(krate: &clean::Crate, cache: &mut Cache, tcx: TyCtxt<
7070
// Set up alias indexes.
7171
for (i, item) in search_index.iter().enumerate() {
7272
for alias in &item.aliases[..] {
73-
aliases.entry(alias.to_lowercase()).or_insert_with(Vec::new).push(i);
73+
aliases.entry(alias.as_str().to_lowercase()).or_default().push(i);
7474
}
7575
}
7676

src/librustdoc/html/render/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ crate struct IndexItem {
103103
crate parent: Option<DefId>,
104104
crate parent_idx: Option<usize>,
105105
crate search_type: Option<IndexItemFunctionType>,
106-
crate aliases: Box<[String]>,
106+
crate aliases: Box<[Symbol]>,
107107
}
108108

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

0 commit comments

Comments
 (0)