Skip to content

Commit fb74b9a

Browse files
committed
---
yaml --- r: 32509 b: refs/heads/dist-snap c: a07ea73 h: refs/heads/master i: 32507: 31a1d35 v: v3
1 parent c505a50 commit fb74b9a

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
@@ -7,6 +7,6 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
99
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
10-
refs/heads/dist-snap: 04f17634091587053ae7d7d35d2318406e8d7d0d
10+
refs/heads/dist-snap: a07ea73bdbc023f80efe809388ed9299ba76bcb8
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/dist-snap/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)