Skip to content

Commit 74b980d

Browse files
authored
Rollup merge of #141377 - nnethercote:rm-unnecessary-is_empty-checks, r=GuillaumeGomez
Remove unnecessary `is_empty` checks Part of #137978. r? `@GuillaumeGomez`
2 parents 5cab70e + c309065 commit 74b980d

2 files changed

Lines changed: 2 additions & 7 deletions

File tree

‎compiler/rustc_span/src/symbol.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2823,7 +2823,7 @@ impl Ident {
28232823
/// Whether this would be the identifier for a tuple field like `self.0`, as
28242824
/// opposed to a named field like `self.thing`.
28252825
pubfnis_numeric(self) -> bool{
2826-
!self.name.is_empty() && self.as_str().bytes().all(|b| b.is_ascii_digit())
2826+
self.as_str().bytes().all(|b| b.is_ascii_digit())
28272827
}
28282828
}
28292829

‎src/librustdoc/passes/collect_intra_doc_links.rs‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,7 @@ fn filter_assoc_items_by_name_and_namespace(
5959
ident:Ident,
6060
ns:Namespace,
6161
) -> implIterator<Item = &ty::AssocItem>{
62-
let iter:Box<dynIterator<Item = &ty::AssocItem>> = if !ident.name.is_empty(){
63-
Box::new(tcx.associated_items(assoc_items_of).filter_by_name_unhygienic(ident.name))
64-
}else{
65-
Box::new([].iter())
66-
};
67-
iter.filter(move |item| {
62+
tcx.associated_items(assoc_items_of).filter_by_name_unhygienic(ident.name).filter(move |item| {
6863
item.namespace() == ns && tcx.hygienic_eq(ident, item.ident(tcx), assoc_items_of)
6964
})
7065
}

0 commit comments

Comments
 (0)