From 6bfaf90fdf67197c511a7594b37d835e964edccd Mon Sep 17 00:00:00 2001 From: Ryan Leckey Date: Thu, 22 Jun 2017 17:10:47 -0700 Subject: Implement Source for Vec and From for File --- src/config.rs | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) (limited to 'src/config.rs') diff --git a/src/config.rs b/src/config.rs index c8fc2e4..f1d5e93 100644 --- a/src/config.rs +++ b/src/config.rs @@ -89,26 +89,8 @@ impl Config { } // Add sources - for source in sources { - let props = match source.collect() { - Ok(props) => props, - Err(error) => { - return ConfigResult(Err(error)); - } - }; - - for (key, val) in &props { - match path::Expression::from_str(key) { - // Set using the path - Ok(expr) => expr.set(&mut cache, val.clone()), - - // Set diretly anyway - _ => { - path::Expression::Identifier(key.clone()) - .set(&mut cache, val.clone()) - } - } - } + if let Err(error) = sources.collect_to(&mut cache) { + return ConfigResult(Err(error)); } // Add overrides -- cgit v1.2.3