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`
This commit is contained in:
bors 2020-12-18 22:54:47 +00:00
commit 50a90975c0
6 changed files with 11 additions and 8 deletions

View File

@ -103,7 +103,7 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
.cx
.tcx
.provided_trait_methods(trait_def_id)
.map(|meth| meth.ident.to_string())
.map(|meth| meth.ident.name)
.collect();
impls.push(Item {

View File

@ -427,7 +427,7 @@ fn merge_attrs(
let provided = trait_
.def_id()
.map(|did| tcx.provided_trait_methods(did).map(|meth| meth.ident.to_string()).collect())
.map(|did| tcx.provided_trait_methods(did).map(|meth| meth.ident.name).collect())
.unwrap_or_default();
debug!("build_impl: impl {:?} for {:?}", trait_.def_id(), for_.def_id());

View File

@ -2065,9 +2065,9 @@ fn clean_impl(impl_: &hir::Item<'_>, cx: &DocContext<'_>) -> Vec<Item> {
build_deref_target_impls(cx, &items, &mut ret);
}
let provided: FxHashSet<String> = trait_
let provided: FxHashSet<Symbol> = trait_
.def_id()
.map(|did| cx.tcx.provided_trait_methods(did).map(|meth| meth.ident.to_string()).collect())
.map(|did| cx.tcx.provided_trait_methods(did).map(|meth| meth.ident.name).collect())
.unwrap_or_default();
let for_ = for_.clean(cx);

View File

@ -1762,7 +1762,7 @@ fn def_id(&self) -> Option<DefId> {
crate struct Impl {
crate unsafety: hir::Unsafety,
crate generics: Generics,
crate provided_trait_methods: FxHashSet<String>,
crate provided_trait_methods: FxHashSet<Symbol>,
crate trait_: Option<Type>,
crate for_: Type,
crate items: Vec<Item>,

View File

@ -2983,7 +2983,7 @@ fn method(
AssocItemLink::GotoSource(did, provided_methods) => {
// We're creating a link from an impl-item to the corresponding
// trait-item and need to map the anchored type accordingly.
let ty = if provided_methods.contains(&*name.as_str()) {
let ty = if provided_methods.contains(&name) {
ItemType::Method
} else {
ItemType::TyMethod
@ -3452,7 +3452,7 @@ fn render_union(
#[derive(Copy, Clone)]
enum AssocItemLink<'a> {
Anchor(Option<&'a str>),
GotoSource(DefId, &'a FxHashSet<String>),
GotoSource(DefId, &'a FxHashSet<Symbol>),
}
impl<'a> AssocItemLink<'a> {

View File

@ -440,7 +440,10 @@ fn from(impl_: clean::Impl) -> Self {
Impl {
is_unsafe: unsafety == rustc_hir::Unsafety::Unsafe,
generics: generics.into(),
provided_trait_methods: provided_trait_methods.into_iter().collect(),
provided_trait_methods: provided_trait_methods
.into_iter()
.map(|x| x.to_string())
.collect(),
trait_: trait_.map(Into::into),
for_: for_.into(),
items: ids(items),