Skip to content

Commit 7cff3c7

Browse files
committed
auto merge of #10119 : Kimundi/rust/option_and_generic, r=alexcrichton
This takes the last reforms on the `Option` type and applies them to `Result` too. For that, I reordered and grouped the functions in both modules, and also did some refactorings: - Added `as_ref` and `as_mut` adapters to `Result`. - Renamed `Result::map_move` to `Result::map` (same for `_err` variant), deleted other map functions. - Made the `.expect()` methods be generic over anything you can fail with. - Updated some doc comments to the line doc comment style - Cleaned up and extended standard trait implementations on `Option` and `Result` - Removed legacy implementations in the `option` and `result` module
2 parents 3a15482 + 415a043 commit 7cff3c7

File tree

8 files changed

+429
-536
lines changed

8 files changed

+429
-536
lines changed

src/librustc/middle/ty.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4560,14 +4560,14 @@ pub fn count_traits_and_supertraits(tcx: ctxt,
45604560
}
45614561

45624562
pub fn get_tydesc_ty(tcx: ctxt) -> Result<t, ~str> {
4563-
do tcx.lang_items.require(TyDescStructLangItem).map_move |tydesc_lang_item| {
4563+
do tcx.lang_items.require(TyDescStructLangItem).map |tydesc_lang_item| {
45644564
tcx.intrinsic_defs.find_copy(&tydesc_lang_item)
45654565
.expect("Failed to resolve TyDesc")
45664566
}
45674567
}
45684568

45694569
pub fn get_opaque_ty(tcx: ctxt) -> Result<t, ~str> {
4570-
do tcx.lang_items.require(OpaqueStructLangItem).map_move |opaque_lang_item| {
4570+
do tcx.lang_items.require(OpaqueStructLangItem).map |opaque_lang_item| {
45714571
tcx.intrinsic_defs.find_copy(&opaque_lang_item)
45724572
.expect("Failed to resolve Opaque")
45734573
}

src/librustuv/uvio.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2464,7 +2464,7 @@ fn test_timer_sleep_simple() {
24642464
unsafe {
24652465
let io = local_io();
24662466
let timer = io.timer_init();
2467-
do timer.map_move |mut t| { t.sleep(1) };
2467+
do timer.map |mut t| { t.sleep(1) };
24682468
}
24692469
}
24702470
}

0 commit comments

Comments
 (0)