diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index fbe3b4ca6f5f..dc77eb52b2e6 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -2823,7 +2823,7 @@ impl Ident { /// Whether this would be the identifier for a tuple field like `self.0`, as /// opposed to a named field like `self.thing`. pub fn is_numeric(self) -> bool { - !self.name.is_empty() && self.as_str().bytes().all(|b| b.is_ascii_digit()) + self.as_str().bytes().all(|b| b.is_ascii_digit()) } } diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index f3e2138d1a57..37628f166002 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -59,12 +59,7 @@ fn filter_assoc_items_by_name_and_namespace( ident: Ident, ns: Namespace, ) -> impl Iterator { - let iter: Box> = if !ident.name.is_empty() { - Box::new(tcx.associated_items(assoc_items_of).filter_by_name_unhygienic(ident.name)) - } else { - Box::new([].iter()) - }; - iter.filter(move |item| { + tcx.associated_items(assoc_items_of).filter_by_name_unhygienic(ident.name).filter(move |item| { item.namespace() == ns && tcx.hygienic_eq(ident, item.ident(tcx), assoc_items_of) }) }