summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2017-01-30 11:37:10 +0100
committerMatthias Beyer <mail@beyermatthias.de>2017-01-30 11:37:10 +0100
commit6373bd1db99e0b7f3630df81e9e481b1ad2e538a (patch)
tree5500067c028905e3119fe3f0122a1a0d8c36bd5b
parent0e01a1ef4eba5dba03a5b7d19889aa3b767217b4 (diff)
Fix backwards-incompatibilities of regex crate
-rw-r--r--libimagtimeui/src/date.rs6
-rw-r--r--libimagtimeui/src/time.rs15
2 files changed, 15 insertions, 6 deletions
diff --git a/libimagtimeui/src/date.rs b/libimagtimeui/src/date.rs
index e44cc389..817ec6e1 100644
--- a/libimagtimeui/src/date.rs
+++ b/libimagtimeui/src/date.rs
@@ -73,9 +73,9 @@ impl Parse for Date {
R.captures(s)
.and_then(|capts| {
- let year = capts.name("Y").and_then(|o| FromStr::from_str(o).ok());
- let month = capts.name("M").and_then(|o| FromStr::from_str(o).ok());
- let day = capts.name("D").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.as_str()).ok());
+ let day = capts.name("D").and_then(|o| FromStr::from_str(o.as_str()).ok());
let year = match year {
None => {
diff --git a/libimagtimeui/src/time.rs b/libimagtimeui/src/time.rs
index 3506a0be..1e52fbd3 100644
--- a/libimagtimeui/src/time.rs
+++ b/libimagtimeui/src/time.rs
@@ -72,9 +72,18 @@ impl Parse for Time {
R.captures(s)
.and_then(|capts| {
- let minute = capts.name("m").and_then(|o| FromStr::from_str(o).ok()).unwrap_or(0);
- let second = capts.name("s").and_then(|o| FromStr::from_str(o).ok()).unwrap_or(0);
- let hour = match capts.name("h").and_then(|o| FromStr::from_str(o).ok()) {
+ let minute = capts
+ .name("m")
+ .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 => {
debug!("No hour");
return None;