Skip to content

Commit 57266f1

Browse files
Continue String to Symbol conversion in rustdoc
1 parent fee693d commit 57266f1

File tree

6 files changed

+11
-8
lines changed

6 files changed

+11
-8
lines changed

src/librustdoc/clean/blanket_impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
103103
.cx
104104
.tcx
105105
.provided_trait_methods(trait_def_id)
106-
.map(|meth| meth.ident.to_string())
106+
.map(|meth| meth.ident.name)
107107
.collect();
108108

109109
impls.push(Item {

src/librustdoc/clean/inline.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ crate fn build_impl(
427427

428428
let provided = trait_
429429
.def_id()
430-
.map(|did| tcx.provided_trait_methods(did).map(|meth| meth.ident.to_string()).collect())
430+
.map(|did| tcx.provided_trait_methods(did).map(|meth| meth.ident.name).collect())
431431
.unwrap_or_default();
432432

433433
debug!("build_impl: impl {:?} for {:?}", trait_.def_id(), for_.def_id());

src/librustdoc/clean/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2065,9 +2065,9 @@ fn clean_impl(impl_: &hir::Item<'_>, cx: &DocContext<'_>) -> Vec<Item> {
20652065
build_deref_target_impls(cx, &items, &mut ret);
20662066
}
20672067

2068-
let provided: FxHashSet<String> = trait_
2068+
let provided: FxHashSet<Symbol> = trait_
20692069
.def_id()
2070-
.map(|did| cx.tcx.provided_trait_methods(did).map(|meth| meth.ident.to_string()).collect())
2070+
.map(|did| cx.tcx.provided_trait_methods(did).map(|meth| meth.ident.name).collect())
20712071
.unwrap_or_default();
20722072

20732073
let for_ = for_.clean(cx);

src/librustdoc/clean/types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1762,7 +1762,7 @@ crate enum ImplPolarity {
17621762
crate struct Impl {
17631763
crate unsafety: hir::Unsafety,
17641764
crate generics: Generics,
1765-
crate provided_trait_methods: FxHashSet<String>,
1765+
crate provided_trait_methods: FxHashSet<Symbol>,
17661766
crate trait_: Option<Type>,
17671767
crate for_: Type,
17681768
crate items: Vec<Item>,

src/librustdoc/html/render/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2966,7 +2966,7 @@ fn render_assoc_item(
29662966
AssocItemLink::GotoSource(did, provided_methods) => {
29672967
// We're creating a link from an impl-item to the corresponding
29682968
// trait-item and need to map the anchored type accordingly.
2969-
let ty = if provided_methods.contains(&*name.as_str()) {
2969+
let ty = if provided_methods.contains(&name) {
29702970
ItemType::Method
29712971
} else {
29722972
ItemType::TyMethod
@@ -3429,7 +3429,7 @@ fn render_union(
34293429
#[derive(Copy, Clone)]
34303430
enum AssocItemLink<'a> {
34313431
Anchor(Option<&'a str>),
3432-
GotoSource(DefId, &'a FxHashSet<String>),
3432+
GotoSource(DefId, &'a FxHashSet<Symbol>),
34333433
}
34343434

34353435
impl<'a> AssocItemLink<'a> {

src/librustdoc/json/conversions.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,10 @@ impl From<clean::Impl> for Impl {
440440
Impl {
441441
is_unsafe: unsafety == rustc_hir::Unsafety::Unsafe,
442442
generics: generics.into(),
443-
provided_trait_methods: provided_trait_methods.into_iter().collect(),
443+
provided_trait_methods: provided_trait_methods
444+
.into_iter()
445+
.map(|x| x.to_string())
446+
.collect(),
444447
trait_: trait_.map(Into::into),
445448
for_: for_.into(),
446449
items: ids(items),

0 commit comments

Comments
 (0)