Refactor: Use function chaining and new error type link

This commit is contained in:
Matthias Beyer 2018-01-04 23:14:02 +01:00
parent 1e2ac14d3b
commit dac817f318
2 changed files with 4 additions and 7 deletions

View file

@ -30,6 +30,7 @@ error_chain! {
foreign_links {
TomlQueryError(::toml_query::error::Error);
UrlError(::url::ParseError);
}
errors {

View file

@ -641,13 +641,9 @@ pub mod store_check {
let mut map = HashMap::new();
for element in iter {
debug!("Checking element = {:?}", element);
let entry = match element? {
Some(e) => e,
None => {
let e = String::from("TODO: Not yet handled");
return Err(e).map_err(From::from);
},
};
let entry = element?.ok_or_else(|| {
LE::from(String::from("TODO: Not yet handled"))
})?;
debug!("Checking entry = {:?}", entry.get_location());