Skip to content

Commit c8e6f47

Browse files
committed
---
yaml --- r: 41711 b: refs/heads/master c: ca93583 h: refs/heads/master i: 41709: 9d10d0f 41707: ae4f7f7 41703: 7c6bc95 41695: a2b04cd v: v3
1 parent c9fe385 commit c8e6f47

File tree

3 files changed

+7
-32
lines changed

3 files changed

+7
-32
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 3c6da7761bf74c54c1d56ba85f4ef55004abcb0a
2+
refs/heads/master: ca9358388a7deeffd9f645d08a5755248b0a7a2a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2f46b763da2c098913884f101b6d71d69af41b49
55
refs/heads/try: 3d5418789064fdb463e872a4e651af1c628a3650

trunk/src/libcore/option.rs

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ pub pure fn map_consume<T, U>(opt: Option<T>,
114114
* As `map`, but consumes the option and gives `f` ownership to avoid
115115
* copying.
116116
*/
117-
match opt { None => None, Some(v) => Some(f(v)) }
117+
if opt.is_some() { Some(f(option::unwrap(move opt))) } else { None }
118118
}
119119

120120
pub pure fn chain<T, U>(opt: Option<T>,
@@ -264,26 +264,12 @@ impl<T> Option<T> {
264264
#[inline(always)]
265265
pure fn map<U>(&self, f: fn(x: &T) -> U) -> Option<U> { map(self, f) }
266266

267-
/// As `map`, but consumes the option and gives `f` ownership to avoid
268-
/// copying.
269-
#[inline(always)]
270-
pure fn map_consume<U>(self, f: fn(v: T) -> U) -> Option<U> {
271-
map_consume(self, f)
272-
}
273-
274267
/// Applies a function to the contained value or returns a default
275268
#[inline(always)]
276269
pure fn map_default<U>(&self, def: U, f: fn(x: &T) -> U) -> U {
277270
map_default(self, move def, f)
278271
}
279272

280-
/// As `map_default`, but consumes the option and gives `f`
281-
/// ownership to avoid copying.
282-
#[inline(always)]
283-
pure fn map_consume_default<U>(self, def: U, f: fn(v: T) -> U) -> U {
284-
match self { None => def, Some(v) => f(v) }
285-
}
286-
287273
/// Performs an operation on the contained value by reference
288274
#[inline(always)]
289275
pure fn iter(&self, f: fn(x: &T)) { iter(self, f) }
@@ -315,17 +301,6 @@ impl<T> Option<T> {
315301
#[inline(always)]
316302
pure fn unwrap(self) -> T { unwrap(self) }
317303

318-
/**
319-
* The option dance. Moves a value out of an option type and returns it,
320-
* replacing the original with `None`.
321-
*
322-
* # Failure
323-
*
324-
* Fails if the value equals `None`.
325-
*/
326-
#[inline(always)]
327-
fn swap_unwrap(&mut self) -> T { swap_unwrap(self) }
328-
329304
/**
330305
* Gets the value out of an option, printing a specified message on
331306
* failure

trunk/src/libstd/time.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ priv fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
460460
tm.tm_yday = v - 1_i32;
461461
Ok(pos)
462462
}
463-
None => Err(~"Invalid year")
463+
None => Err(~"Invalid day of year")
464464
}
465465
}
466466
'k' => {
@@ -554,7 +554,7 @@ priv fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
554554
tm.tm_wday = v;
555555
Ok(pos)
556556
}
557-
None => Err(~"Invalid weekday")
557+
None => Err(~"Invalid day of week")
558558
}
559559
}
560560
'v' => {
@@ -569,7 +569,7 @@ priv fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
569569
// FIXME (#2350): range check.
570570
match match_digits(s, pos, 1u, false) {
571571
Some(item) => { let (v, pos) = item; tm.tm_wday = v; Ok(pos) }
572-
None => Err(~"Invalid weekday")
572+
None => Err(~"Invalid day of week")
573573
}
574574
}
575575
//'X' {}
@@ -582,7 +582,7 @@ priv fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
582582
tm.tm_year = v - 1900_i32;
583583
Ok(pos)
584584
}
585-
None => Err(~"Invalid weekday")
585+
None => Err(~"Invalid year")
586586
}
587587
}
588588
'y' => {
@@ -593,7 +593,7 @@ priv fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
593593
tm.tm_year = v - 1900_i32;
594594
Ok(pos)
595595
}
596-
None => Err(~"Invalid weekday")
596+
None => Err(~"Invalid year")
597597
}
598598
}
599599
'Z' => {

0 commit comments

Comments
 (0)