Skip to content

Commit 50a9097

Browse files
committed
Auto merge of #80154 - GuillaumeGomez:str-to-symbol, r=jyn514
Continue String to Symbol conversion in rustdoc (2) Follow-up of #80119. This is the last one (and I actually expected more conversions but seems like it was the last one remaining...). r? `@jyn514`
2 parents f745834 + 57266f1 commit 50a9097

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
@@ -2983,7 +2983,7 @@ fn render_assoc_item(
29832983
AssocItemLink::GotoSource(did, provided_methods) => {
29842984
// We're creating a link from an impl-item to the corresponding
29852985
// trait-item and need to map the anchored type accordingly.
2986-
let ty = if provided_methods.contains(&*name.as_str()) {
2986+
let ty = if provided_methods.contains(&name) {
29872987
ItemType::Method
29882988
} else {
29892989
ItemType::TyMethod
@@ -3452,7 +3452,7 @@ fn render_union(
34523452
#[derive(Copy, Clone)]
34533453
enum AssocItemLink<'a> {
34543454
Anchor(Option<&'a str>),
3455-
GotoSource(DefId, &'a FxHashSet<String>),
3455+
GotoSource(DefId, &'a FxHashSet<Symbol>),
34563456
}
34573457

34583458
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)