This repository was archived by the owner on May 28, 2025. It is now read-only.
Commit 5c9cd82
authored
Rollup merge of rust-lang#71899 - cuviper:try_find_map, r=dtolnay
Refactor `try_find` a little
~~This works like `find_map`, but mapping to a `Try` type. It stops when `Ok` is `Some(value)`, with an additional short-circuit on `Try::Error`. This is similar to the unstable `try_find`, but has the advantage of being able to directly return the user's `R: Try` type directly, rather than converting to `Result`.~~
(removed -- `try_find_map` was declined in review)
This PR also refactors `try_find` a little to match style. The `E` type parameter was unnecessary, so it's now removed. The folding closure now has reduced parametricity on just `T = Self::Item`, rather
than the whole `Self` iterator type. There's otherwise no functional change in this.1 file changed
+18
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2265 | 2265 | | |
2266 | 2266 | | |
2267 | 2267 | | |
2268 | | - | |
| 2268 | + | |
2269 | 2269 | | |
2270 | 2270 | | |
2271 | 2271 | | |
| |||
2286 | 2286 | | |
2287 | 2287 | | |
2288 | 2288 | | |
2289 | | - | |
| 2289 | + | |
2290 | 2290 | | |
2291 | 2291 | | |
2292 | 2292 | | |
2293 | | - | |
2294 | | - | |
2295 | | - | |
2296 | | - | |
2297 | | - | |
2298 | | - | |
2299 | | - | |
2300 | | - | |
2301 | | - | |
| 2293 | + | |
| 2294 | + | |
| 2295 | + | |
| 2296 | + | |
| 2297 | + | |
| 2298 | + | |
| 2299 | + | |
| 2300 | + | |
| 2301 | + | |
| 2302 | + | |
| 2303 | + | |
| 2304 | + | |
| 2305 | + | |
| 2306 | + | |
| 2307 | + | |
| 2308 | + | |
2302 | 2309 | | |
2303 | 2310 | | |
2304 | 2311 | | |
| |||
0 commit comments