Refactoring matching

This commit is contained in:
Tom Gallacher 2015-09-03 13:43:36 +01:00
parent 7b31609418
commit b53e9d940f
1 changed files with 1 additions and 22 deletions

View File

@ -300,28 +300,7 @@ pub fn parse<'a, I>(parsed: &mut Parsed, mut s: &str, items: I) -> ParseResult<(
s = &s[2..]; s = &s[2..];
} }
Nanosecond => { Nanosecond | Nanosecond3 | Nanosecond6 | Nanosecond9=> {
if s.starts_with(".") {
let nano = try_consume!(scan::nanosecond(&s[1..]));
try!(parsed.set_nanosecond(nano));
}
}
Nanosecond3 => {
if s.starts_with(".") {
let nano = try_consume!(scan::nanosecond(&s[1..]));
try!(parsed.set_nanosecond(nano));
}
}
Nanosecond6 => {
if s.starts_with(".") {
let nano = try_consume!(scan::nanosecond(&s[1..]));
try!(parsed.set_nanosecond(nano));
}
}
Nanosecond9 => {
if s.starts_with(".") { if s.starts_with(".") {
let nano = try_consume!(scan::nanosecond(&s[1..])); let nano = try_consume!(scan::nanosecond(&s[1..]));
try!(parsed.set_nanosecond(nano)); try!(parsed.set_nanosecond(nano));