From 8bff6ada6cef7062eb91bc445a4816b38f5eb9c6 Mon Sep 17 00:00:00 2001 From: Henry de Valence Date: Fri, 14 Feb 2020 16:42:16 -0800 Subject: [PATCH] Prevent a crash serializing configs. --- zebrad/src/commands/config.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zebrad/src/commands/config.rs b/zebrad/src/commands/config.rs index 730af4d0c..3716babc3 100644 --- a/zebrad/src/commands/config.rs +++ b/zebrad/src/commands/config.rs @@ -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) => {