From: topecongiro Date: Mon, 11 Dec 2017 15:54:55 +0000 (+0900) Subject: Warn when there are unknown config options X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=17154c30cbd68db17589acd63bc5f86e5902202d;p=rust.git Warn when there are unknown config options --- diff --git a/src/config.rs b/src/config.rs index ed44df022a9..ff90a96b91e 100644 --- a/src/config.rs +++ b/src/config.rs @@ -394,22 +394,23 @@ pub fn from_toml(toml: &str) -> Result { $( stringify!($i) => (), )+ - _ => { - let msg = - &format!("Warning: Unknown configuration option `{}`\n", - key); - err.push_str(msg) - } + _ => { + let msg = + &format!("Warning: Unknown configuration option `{}`\n", key); + err.push_str(msg) + } } } } match parsed.try_into() { - Ok(parsed_config) => - Ok(Config::default().fill_from_parsed_config(parsed_config)), + Ok(parsed_config) => { + eprintln!("{}", err); + Ok(Config::default().fill_from_parsed_config(parsed_config)) + } Err(e) => { err.push_str("Error: Decoding config file failed:\n"); err.push_str(format!("{}\n", e).as_str()); - err.push_str("Please check your config file.\n"); + err.push_str("Please check your config file."); Err(err) } }