Skip to content

Commit 2e1008b

Browse files
committed
---
yaml --- r: 28425 b: refs/heads/try c: a07ea73 h: refs/heads/master i: 28423: 636d584 v: v3
1 parent 0e22c3a commit 2e1008b

File tree

4 files changed

+59
-56
lines changed

4 files changed

+59
-56
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
5-
refs/heads/try: 04f17634091587053ae7d7d35d2318406e8d7d0d
5+
refs/heads/try: a07ea73bdbc023f80efe809388ed9299ba76bcb8
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df

branches/try/src/libcore/option.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ pure fn map_consume<T, U>(+opt: Option<T>, f: fn(+T) -> U) -> Option<U> {
7474
* As `map`, but consumes the option and gives `f` ownership to avoid
7575
* copying.
7676
*/
77-
if opt.is_some() { Some(f(option::unwrap(move opt))) } else { None }
77+
if opt.is_some() { Some(f(option::unwrap(opt))) } else { None }
7878
}
7979

8080
pure fn chain<T, U>(opt: Option<T>, f: fn(T) -> Option<U>) -> Option<U> {
@@ -112,7 +112,7 @@ pure fn while_some<T>(+x: Option<T>, blk: fn(+T) -> Option<T>) {
112112
113113
let mut opt <- x;
114114
while opt.is_some() {
115-
opt = blk(unwrap(move opt));
115+
opt = blk(unwrap(opt));
116116
}
117117
}
118118

@@ -160,8 +160,10 @@ pure fn iter_ref<T>(opt: &Option<T>, f: fn(x: &T)) {
160160
match *opt { None => (), Some(ref t) => f(t) }
161161
}
162162

163+
// tjc: shouldn't this be - instead of +?
164+
// then could get rid of some superfluous moves
163165
#[inline(always)]
164-
pure fn unwrap<T>(+opt: Option<T>) -> T {
166+
pure fn unwrap<T>(-opt: Option<T>) -> T {
165167
/*!
166168
* Moves a value out of an option type and returns it.
167169
*
@@ -184,7 +186,7 @@ fn swap_unwrap<T>(opt: &mut Option<T>) -> T {
184186
pure fn unwrap_expect<T>(+opt: Option<T>, reason: &str) -> T {
185187
//! As unwrap, but with a specified failure message.
186188
if opt.is_none() { fail reason.to_unique(); }
187-
unwrap(move opt)
189+
unwrap(opt)
188190
}
189191

190192
// Some of these should change to be &Option<T>, some should not. See below.

0 commit comments

Comments
 (0)