From 13ff09d8c699a2b44032796ff8d46ee70956d9d8 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Fri, 12 Jan 2018 16:31:41 +0100 Subject: [PATCH] libimagtodo: Replace read with typed read --- lib/domain/libimagtodo/src/task.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/domain/libimagtodo/src/task.rs b/lib/domain/libimagtodo/src/task.rs index 88c2e1f0..ef80041f 100644 --- a/lib/domain/libimagtodo/src/task.rs +++ b/lib/domain/libimagtodo/src/task.rs @@ -25,7 +25,7 @@ use error::Result; use libimagstore::store::Entry; use uuid::Uuid; -use toml_query::read::TomlValueReadExt; +use toml_query::read::TomlValueReadTypeExt; pub trait Task { fn get_uuid(&self) -> Result; @@ -34,12 +34,10 @@ pub trait Task { impl Task for Entry { fn get_uuid(&self) -> Result { self.get_header() - .read("todo.uuid") + .read_string("todo.uuid") .chain_err(|| TEK::StoreError)? - .ok_or(TE::from_kind(TEK::HeaderFieldMissing))? - .as_str() - .ok_or(TE::from_kind(TEK::HeaderTypeError)) - .and_then(|u| Uuid::parse_str(u).chain_err(|| TEK::UuidParserError)) + .ok_or(TE::from_kind(TEK::HeaderFieldMissing)) + .and_then(|u| Uuid::parse_str(&u).chain_err(|| TEK::UuidParserError)) } }