]> git.lizzy.rs Git - rust.git/commitdiff
auto merge of #8294 : erickt/rust/map-move, r=bblum
authorbors <bors@rust-lang.org>
Wed, 7 Aug 2013 20:23:07 +0000 (13:23 -0700)
committerbors <bors@rust-lang.org>
Wed, 7 Aug 2013 20:23:07 +0000 (13:23 -0700)
According to #7887, we've decided to use the syntax of `fn map<U>(f: &fn(&T) -> U) -> U`, which passes a reference to the closure, and to `fn map_move<U>(f: &fn(T) -> U) -> U` which moves the value into the closure. This PR adds these `.map_move()` functions to `Option` and `Result`.

In addition, it has these other minor features:

* Replaces a couple uses of `option.get()`, `result.get()`, and `result.get_err()` with `option.unwrap()`, `result.unwrap()`, and `result.unwrap_err()`. (See #8268 and #8288 for a more thorough adaptation of this functionality.
* Removes `option.take_map()` and `option.take_map_default()`. These two functions can be easily written as `.take().map_move(...)`.
* Adds a better error message to `result.unwrap()` and `result.unwrap_err()`.

1  2 
src/librustc/middle/typeck/check/mod.rs
src/librusti/rusti.rs
src/libstd/iterator.rs
src/libstd/str.rs

Simple merge
Simple merge
Simple merge