Prevent a crash serializing configs.

This commit is contained in:
Henry de Valence 2020-02-14 16:42:16 -08:00 committed by Deirdre Connolly
parent 00edcae0c2
commit 8bff6ada6c
1 changed files with 4 additions and 1 deletions

View File

@ -28,7 +28,10 @@ impl Runnable for ConfigCmd {
"
.to_owned(); // The default name and location of the config file is defined in ../commands.rs
output += &toml::to_string_pretty(&default_config)
// this avoids a ValueAfterTable error
// https://github.com/alexcrichton/toml-rs/issues/145
let conf = toml::Value::try_from(default_config).unwrap();
output += &toml::to_string_pretty(&conf)
.expect("default config should be serializable");
match self.output_file {
Some(ref output_file) => {