diff options
Diffstat (limited to 'src/conf.rs')
-rw-r--r-- | src/conf.rs | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/src/conf.rs b/src/conf.rs index eec5d86..e36a932 100644 --- a/src/conf.rs +++ b/src/conf.rs @@ -1,4 +1,4 @@ -use serde_derive::{Serialize, Deserialize}; +use serde_derive::{ Serialize, Deserialize }; use std::path::{ PathBuf, Path }; use toml::de; use log::{ error, trace }; @@ -57,15 +57,9 @@ impl Conf { trace!("Written some bytes to {}", fname.to_string_lossy()); Ok(()) } - - #[allow(unused)] - pub fn get_compiler_args(&self) -> String { - "somedef".to_string() - } } - pub fn get_conf() -> Conf { match get_conf_maybe() { Ok(c) => c, @@ -89,7 +83,6 @@ pub fn get_conf_maybe() -> Result<Conf, Error> { } if !current.pop() { - error!("Not a evr subtree."); return Err(Error::new(ErrorKind::NotFound, "Not a evr subtree")); } }; @@ -98,13 +91,10 @@ pub fn get_conf_maybe() -> Result<Conf, Error> { let buf_result: Result<Conf, de::Error> = de::from_str(&raw_buf); - match buf_result { - Ok(mut buf) => { + buf_result + .map(|mut buf| { buf.path = Some(path.clone()); - Ok(buf) - }, - Err(err) => { - Err(Error::new(ErrorKind::InvalidData, err)) - } - } + buf + }) + .map_err(|err| Error::new(ErrorKind::InvalidData, err)) } |