]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #101690 - kadiwa4:avoid_iterator_last, r=oli-obk
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>
Tue, 13 Sep 2022 11:21:31 +0000 (16:51 +0530)
committerGitHub <noreply@github.com>
Tue, 13 Sep 2022 11:21:31 +0000 (16:51 +0530)
Avoid `Iterator::last`

Adapters like `Filter` and `Map` use the default implementation of `Iterator::last` which is not short-circuiting (and so does `core::str::Split`). The predicate function will be run for every single item of the underlying iterator. I hope that removing those calls to `last` results in slight performance improvements.

1  2 
compiler/rustc_hir/src/hir.rs

Simple merge