Commit a19d61a
committed
Specialize methods on iter::Cloned<I> where I::Item: Copy.
Instead of cloning a bunch of copyable types only to drop them (in `nth`,
`last`, and `count`), take advantage of rust-lang#1521 (Copy clone semantics) and don't
bother cloning them in the first place (directly call `nth`, `last`, and `count`
on the wrapped iterator). If the wrapped iterator optimizes these methods,
`Cloned` now inherits this optimization.1 parent 289f3a4 commit a19d61a
1 file changed
+17
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
401 | 401 | | |
402 | 402 | | |
403 | 403 | | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
404 | 421 | | |
405 | 422 | | |
406 | 423 | | |
| |||
0 commit comments