summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2017-07-09 21:53:13 +0200
committerMatthias Beyer <mail@beyermatthias.de>2017-07-13 19:40:13 +0200
commit86adb4d0648442ac6c125a3d3c9f7db252e5b08d (patch)
treeed821864d331bf8a992f9c070f2f2ac96f34c438
parent218977ae17d57c3cbda5ac913477f60bbf7dd5af (diff)
Update toml-query: 0.2.0 -> 0.3.0
-rw-r--r--libimagentrydatetime/Cargo.toml2
-rw-r--r--libimagentrydatetime/src/datetime.rs23
2 files changed, 17 insertions, 8 deletions
diff --git a/libimagentrydatetime/Cargo.toml b/libimagentrydatetime/Cargo.toml
index 1c810e9f..119487fc 100644
--- a/libimagentrydatetime/Cargo.toml
+++ b/libimagentrydatetime/Cargo.toml
@@ -15,7 +15,7 @@ homepage = "http://imag-pim.org"
[dependencies]
chrono = "0.3"
-toml-query = "0.2"
+toml-query = "0.3"
lazy_static = "0.2"
toml = "0.4"
diff --git a/libimagentrydatetime/src/datetime.rs b/libimagentrydatetime/src/datetime.rs
index b78dac08..6e7911bf 100644
--- a/libimagentrydatetime/src/datetime.rs
+++ b/libimagentrydatetime/src/datetime.rs
@@ -65,9 +65,10 @@ impl EntryDate for Entry {
.map_err_into(DEK::ReadDateError)
.and_then(|v| {
match v {
- &Value::String(ref s) => s.parse::<NaiveDateTime>()
+ Some(&Value::String(ref s)) => s.parse::<NaiveDateTime>()
.map_err_into(DEK::DateTimeParsingError),
- _ => Err(DEK::DateHeaderFieldTypeError.into_error()),
+ Some(_) => Err(DEK::DateHeaderFieldTypeError.into_error()),
+ _ => Err(DEK::ReadDateError.into_error()),
}
})
}
@@ -131,9 +132,10 @@ impl EntryDate for Entry {
.map_err_into(DEK::ReadDateTimeRangeError)
.and_then(|v| {
match v {
- &Value::String(ref s) => s.parse::<NaiveDateTime>()
+ Some(&Value::String(ref s)) => s.parse::<NaiveDateTime>()
.map_err_into(DEK::DateTimeParsingError),
- _ => Err(DEK::DateHeaderFieldTypeError.into_error()),
+ Some(_) => Err(DEK::DateHeaderFieldTypeError.into_error()),
+ _ => Err(DEK::ReadDateError.into_error()),
}
}));
@@ -143,9 +145,10 @@ impl EntryDate for Entry {
.map_err_into(DEK::ReadDateTimeRangeError)
.and_then(|v| {
match v {
- &Value::String(ref s) => s.parse::<NaiveDateTime>()
+ Some(&Value::String(ref s)) => s.parse::<NaiveDateTime>()
.map_err_into(DEK::DateTimeParsingError),
- _ => Err(DEK::DateHeaderFieldTypeError.into_error()),
+ Some(_) => Err(DEK::DateHeaderFieldTypeError.into_error()),
+ _ => Err(DEK::ReadDateError.into_error()),
}
}));
@@ -250,6 +253,9 @@ mod tests {
assert!(hdr_field.is_ok());
let hdr_field = hdr_field.unwrap();
+ assert!(hdr_field.is_some());
+ let hdr_field = hdr_field.unwrap();
+
match *hdr_field {
Value::String(ref s) => assert_eq!("2000-01-02T03:04:05", s),
_ => assert!(false, "Wrong header type"),
@@ -315,7 +321,10 @@ mod tests {
let hdr_field = entry.get_header().read(&DATE_HEADER_LOCATION);
- assert!(hdr_field.is_err(), format!("Expected Err(_), got: {:?}", hdr_field));
+ assert!(hdr_field.is_ok());
+ let hdr_field = hdr_field.unwrap();
+
+ assert!(hdr_field.is_none());
}
}