From 8063b2fef5e4a0f6779d3c0213b4c8aac80b7f47 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Sat, 28 Dec 2024 21:29:08 +0100 Subject: [PATCH] Skip parsing empty config TOML doc --- src/fmt.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/fmt.rs b/src/fmt.rs index 304c494..f3cd7a4 100644 --- a/src/fmt.rs +++ b/src/fmt.rs @@ -115,6 +115,10 @@ impl Config { impl FromStr for Config { type Err = &'static str; fn from_str(s: &str) -> Result { + if s.is_empty() { + return Ok(Self::new()); + } + let toml = s.parse::().map_err(|_| "failed to parse as toml")?; Ok(Config { always_trailing_comma: toml