Skip to content

Commit e2cc7e8

Browse files
committed
---
yaml --- r: 38182 b: refs/heads/try c: 197a1f9 h: refs/heads/master v: v3
1 parent a1ed68b commit e2cc7e8

File tree

3 files changed

+41
-80
lines changed

3 files changed

+41
-80
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: 09bb07bed9166105ea961a42b5fff7739ae0d2e9
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: eb8fd119c65c67f3b1b8268cc7341c22d39b7b61
5-
refs/heads/try: 8ec13a90aa026a8b6a4c5fc987816ec7a805b898
5+
refs/heads/try: 197a1f9cfe7839bcff0020c54af3e90c4985174d
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278

branches/try/src/libcore/result.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ impl<T, E> Result<T, E> {
234234
pure fn unwrap(self) -> T { unwrap(self) }
235235

236236
#[inline(always)]
237-
pure fn unwrap_err(self) -> T { unwrap(self) }
237+
pure fn unwrap_err(self) -> E { unwrap_err(self) }
238238

239239
#[inline(always)]
240240
pure fn chain<U>(self, op: fn(T) -> Result<U,E>) -> Result<U,E> {

branches/try/src/libstd/time.rs

Lines changed: 39 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -385,36 +385,22 @@ priv fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
385385
None => Err(~"Invalid year")
386386
},
387387
'c' => {
388-
// FIXME(#3724): cleanup
389-
result::chain(
390-
result::chain(
391-
result::chain(
392-
result::chain(
393-
result::chain(
394-
result::chain(
395-
result::chain(
396-
result::chain(
397-
move parse_type(s, pos, 'a', tm),
398-
|pos| parse_char(s, pos, ' ')),
399-
|pos| parse_type(s, pos, 'b', tm)),
400-
|pos| parse_char(s, pos, ' ')),
401-
|pos| parse_type(s, pos, 'e', tm)),
402-
|pos| parse_char(s, pos, ' ')),
403-
|pos| parse_type(s, pos, 'T', tm)),
404-
|pos| parse_char(s, pos, ' ')),
405-
|pos| parse_type(s, pos, 'Y', tm))
388+
parse_type(s, pos, 'a', tm)
389+
.chain(|pos| parse_char(s, pos, ' '))
390+
.chain(|pos| parse_type(s, pos, 'b', tm))
391+
.chain(|pos| parse_char(s, pos, ' '))
392+
.chain(|pos| parse_type(s, pos, 'e', tm))
393+
.chain(|pos| parse_char(s, pos, ' '))
394+
.chain(|pos| parse_type(s, pos, 'T', tm))
395+
.chain(|pos| parse_char(s, pos, ' '))
396+
.chain(|pos| parse_type(s, pos, 'Y', tm))
406397
}
407398
'D' | 'x' => {
408-
// FIXME(#3724): cleanup
409-
result::chain(
410-
result::chain(
411-
result::chain(
412-
result::chain(
413-
move parse_type(s, pos, 'm', tm),
414-
|pos| parse_char(s, pos, '/')),
415-
|pos| parse_type(s, pos, 'd', tm)),
416-
|pos| parse_char(s, pos, '/')),
417-
|pos| parse_type(s, pos, 'y', tm))
399+
parse_type(s, pos, 'm', tm)
400+
.chain(|pos| parse_char(s, pos, '/'))
401+
.chain(|pos| parse_type(s, pos, 'd', tm))
402+
.chain(|pos| parse_char(s, pos, '/'))
403+
.chain(|pos| parse_type(s, pos, 'y', tm))
418404
}
419405
'd' => match match_digits(s, pos, 2u, false) {
420406
Some(item) => { let (v, pos) = item; tm.tm_mday = v; Ok(pos) }
@@ -425,16 +411,11 @@ priv fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
425411
None => Err(~"Invalid day of the month")
426412
},
427413
'F' => {
428-
// FIXME(#3724): cleanup
429-
result::chain(
430-
result::chain(
431-
result::chain(
432-
result::chain(
433-
move parse_type(s, pos, 'Y', tm),
434-
|pos| parse_char(s, pos, '-')),
435-
|pos| parse_type(s, pos, 'm', tm)),
436-
|pos| parse_char(s, pos, '-')),
437-
|pos| parse_type(s, pos, 'd', tm))
414+
parse_type(s, pos, 'Y', tm)
415+
.chain(|pos| parse_char(s, pos, '-'))
416+
.chain(|pos| parse_type(s, pos, 'm', tm))
417+
.chain(|pos| parse_char(s, pos, '-'))
418+
.chain(|pos| parse_type(s, pos, 'd', tm))
438419
}
439420
'H' => {
440421
// FIXME (#2350): range check.
@@ -515,28 +496,18 @@ priv fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
515496
None => Err(~"Invalid hour")
516497
},
517498
'R' => {
518-
// FIXME(#3724): cleanup
519-
result::chain(
520-
result::chain(
521-
move parse_type(s, pos, 'H', tm),
522-
|pos| parse_char(s, pos, ':')),
523-
|pos| parse_type(s, pos, 'M', tm))
499+
parse_type(s, pos, 'H', tm)
500+
.chain(|pos| parse_char(s, pos, ':'))
501+
.chain(|pos| parse_type(s, pos, 'M', tm))
524502
}
525503
'r' => {
526-
// FIXME(#3724): cleanup
527-
result::chain(
528-
result::chain(
529-
result::chain(
530-
result::chain(
531-
result::chain(
532-
result::chain(
533-
move parse_type(s, pos, 'I', tm),
534-
|pos| parse_char(s, pos, ':')),
535-
|pos| parse_type(s, pos, 'M', tm)),
536-
|pos| parse_char(s, pos, ':')),
537-
|pos| parse_type(s, pos, 'S', tm)),
538-
|pos| parse_char(s, pos, ' ')),
539-
|pos| parse_type(s, pos, 'p', tm))
504+
parse_type(s, pos, 'I', tm)
505+
.chain(|pos| parse_char(s, pos, ':'))
506+
.chain(|pos| parse_type(s, pos, 'M', tm))
507+
.chain(|pos| parse_char(s, pos, ':'))
508+
.chain(|pos| parse_type(s, pos, 'S', tm))
509+
.chain(|pos| parse_char(s, pos, ' '))
510+
.chain(|pos| parse_type(s, pos, 'p', tm))
540511
}
541512
'S' => {
542513
// FIXME (#2350): range check.
@@ -551,16 +522,11 @@ priv fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
551522
}
552523
//'s' {}
553524
'T' | 'X' => {
554-
// FIXME(#3724): cleanup
555-
result::chain(
556-
result::chain(
557-
result::chain(
558-
result::chain(
559-
move parse_type(s, pos, 'H', tm),
560-
|pos| parse_char(s, pos, ':')),
561-
|pos| parse_type(s, pos, 'M', tm)),
562-
|pos| parse_char(s, pos, ':')),
563-
|pos| parse_type(s, pos, 'S', tm))
525+
parse_type(s, pos, 'H', tm)
526+
.chain(|pos| parse_char(s, pos, ':'))
527+
.chain(|pos| parse_type(s, pos, 'M', tm))
528+
.chain(|pos| parse_char(s, pos, ':'))
529+
.chain(|pos| parse_type(s, pos, 'S', tm))
564530
}
565531
't' => parse_char(s, pos, '\t'),
566532
'u' => {
@@ -575,16 +541,11 @@ priv fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
575541
}
576542
}
577543
'v' => {
578-
// FIXME(#3724): cleanup
579-
result::chain(
580-
result::chain(
581-
result::chain(
582-
result::chain(
583-
move parse_type(s, pos, 'e', tm),
584-
|pos| parse_char(s, pos, '-')),
585-
|pos| parse_type(s, pos, 'b', tm)),
586-
|pos| parse_char(s, pos, '-')),
587-
|pos| parse_type(s, pos, 'Y', tm))
544+
parse_type(s, pos, 'e', tm)
545+
.chain(|pos| parse_char(s, pos, '-'))
546+
.chain(|pos| parse_type(s, pos, 'b', tm))
547+
.chain(|pos| parse_char(s, pos, '-'))
548+
.chain(|pos| parse_type(s, pos, 'Y', tm))
588549
}
589550
//'W' {}
590551
'w' => {

0 commit comments

Comments
 (0)