Pass config as reference

This commit is contained in:
Jake Howard 2017-07-18 13:56:27 +01:00
parent 7c82aa6623
commit 240069f42c
Signed by: jake
GPG key ID: 57AFB45680EDD477
2 changed files with 2 additions and 2 deletions

View file

@ -15,7 +15,7 @@ pub struct Config {
impl Config { impl Config {
fn new(raw: Value) -> Config { fn new(raw: Value) -> Config {
return Config { return Config {
input: read::get_input_files(raw), input: read::get_input_files(&raw),
..Default::default() ..Default::default()
}; };
} }

View file

@ -22,7 +22,7 @@ pub fn read() -> String {
} }
pub fn get_input_files(conf: Value) -> Vec<PathBuf> { pub fn get_input_files(conf: &Value) -> Vec<PathBuf> {
let working_dir = current_dir().unwrap(); let working_dir = current_dir().unwrap();
let input_values = conf.get("input").unwrap().as_sequence().unwrap().to_vec(); let input_values = conf.get("input").unwrap().as_sequence().unwrap().to_vec();
return input_values.into_iter().map(|x| working_dir.join(x.as_str().unwrap().to_string())).collect(); return input_values.into_iter().map(|x| working_dir.join(x.as_str().unwrap().to_string())).collect();