Fix backwards-incompatibilities of regex crate

This commit is contained in:
Matthias Beyer 2017-01-30 11:37:10 +01:00
parent 0e01a1ef4e
commit 6373bd1db9
2 changed files with 15 additions and 6 deletions

View file

@ -73,9 +73,9 @@ impl Parse for Date {
R.captures(s) R.captures(s)
.and_then(|capts| { .and_then(|capts| {
let year = capts.name("Y").and_then(|o| FromStr::from_str(o).ok()); let year = capts.name("Y").and_then(|o| FromStr::from_str(o.as_str()).ok());
let month = capts.name("M").and_then(|o| FromStr::from_str(o).ok()); let month = capts.name("M").and_then(|o| FromStr::from_str(o.as_str()).ok());
let day = capts.name("D").and_then(|o| FromStr::from_str(o).ok()); let day = capts.name("D").and_then(|o| FromStr::from_str(o.as_str()).ok());
let year = match year { let year = match year {
None => { None => {

View file

@ -72,9 +72,18 @@ impl Parse for Time {
R.captures(s) R.captures(s)
.and_then(|capts| { .and_then(|capts| {
let minute = capts.name("m").and_then(|o| FromStr::from_str(o).ok()).unwrap_or(0); let minute = capts
let second = capts.name("s").and_then(|o| FromStr::from_str(o).ok()).unwrap_or(0); .name("m")
let hour = match capts.name("h").and_then(|o| FromStr::from_str(o).ok()) { .and_then(|o| FromStr::from_str(o.as_str()).ok())
.unwrap_or(0);
let second = capts
.name("s")
.and_then(|o| FromStr::from_str(o.as_str()).ok())
.unwrap_or(0);
let hour = match capts
.name("h")
.and_then(|o| FromStr::from_str(o.as_str()).ok())
{
None => { None => {
debug!("No hour"); debug!("No hour");
return None; return None;