Skip to content

Commit a9987c4

Browse files
author
Jorge Aparicio
committed
---
yaml --- r: 163240 b: refs/heads/snap-stage3 c: 56ecb51 h: refs/heads/master v: v3
1 parent b792e06 commit a9987c4

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 9146a919b616e39e528e4d7100d16eef52f1f852
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 567b90ff095076054c98fa2f08d6c552ae60968d
4+
refs/heads/snap-stage3: 56ecb51ba62b973e3a415cc0d6d6979dd7aeee7d
55
refs/heads/try: 20cbbffeefc1f35e2ea63afce7b42fbd79611d42
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/src/libcore/option.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ use result::Result::{Ok, Err};
156156
use slice;
157157
use slice::AsSlice;
158158
use clone::Clone;
159-
use ops::Deref;
159+
use ops::{Deref, FnOnce};
160160

161161
// Note that this is not a lang item per se, but it has a hidden dependency on
162162
// `Iterator`, which is one. The compiler assumes that the `next` method of
@@ -389,7 +389,7 @@ impl<T> Option<T> {
389389
/// ```
390390
#[inline]
391391
#[unstable = "waiting for conventions"]
392-
pub fn unwrap_or_else(self, f: || -> T) -> T {
392+
pub fn unwrap_or_else<F: FnOnce() -> T>(self, f: F) -> T {
393393
match self {
394394
Some(x) => x,
395395
None => f()
@@ -413,7 +413,7 @@ impl<T> Option<T> {
413413
/// ```
414414
#[inline]
415415
#[unstable = "waiting for unboxed closures"]
416-
pub fn map<U>(self, f: |T| -> U) -> Option<U> {
416+
pub fn map<U, F: FnOnce(T) -> U>(self, f: F) -> Option<U> {
417417
match self {
418418
Some(x) => Some(f(x)),
419419
None => None
@@ -433,7 +433,7 @@ impl<T> Option<T> {
433433
/// ```
434434
#[inline]
435435
#[unstable = "waiting for unboxed closures"]
436-
pub fn map_or<U>(self, def: U, f: |T| -> U) -> U {
436+
pub fn map_or<U, F: FnOnce(T) -> U>(self, def: U, f: F) -> U {
437437
match self {
438438
Some(t) => f(t),
439439
None => def
@@ -455,7 +455,7 @@ impl<T> Option<T> {
455455
/// ```
456456
#[inline]
457457
#[unstable = "waiting for unboxed closures"]
458-
pub fn map_or_else<U>(self, def: || -> U, f: |T| -> U) -> U {
458+
pub fn map_or_else<U, D: FnOnce() -> U, F: FnOnce(T) -> U>(self, def: D, f: F) -> U {
459459
match self {
460460
Some(t) => f(t),
461461
None => def()
@@ -497,7 +497,7 @@ impl<T> Option<T> {
497497
/// ```
498498
#[inline]
499499
#[experimental]
500-
pub fn ok_or_else<E>(self, err: || -> E) -> Result<T, E> {
500+
pub fn ok_or_else<E, F: FnOnce() -> E>(self, err: F) -> Result<T, E> {
501501
match self {
502502
Some(v) => Ok(v),
503503
None => Err(err()),
@@ -615,7 +615,7 @@ impl<T> Option<T> {
615615
/// ```
616616
#[inline]
617617
#[unstable = "waiting for unboxed closures"]
618-
pub fn and_then<U>(self, f: |T| -> Option<U>) -> Option<U> {
618+
pub fn and_then<U, F: FnOnce(T) -> Option<U>>(self, f: F) -> Option<U> {
619619
match self {
620620
Some(x) => f(x),
621621
None => None,
@@ -667,7 +667,7 @@ impl<T> Option<T> {
667667
/// ```
668668
#[inline]
669669
#[unstable = "waiting for unboxed closures"]
670-
pub fn or_else(self, f: || -> Option<T>) -> Option<T> {
670+
pub fn or_else<F: FnOnce() -> Option<T>>(self, f: F) -> Option<T> {
671671
match self {
672672
Some(_) => self,
673673
None => f()

0 commit comments

Comments
 (0)