diff options
author | josh rotenberg <joshrotenberg@users.noreply.github.com> | 2021-05-24 11:59:32 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-24 11:59:32 -0700 |
commit | 7a3513200f0688009a209452617e3a61ca557051 (patch) | |
tree | b2f827206eb7e0e4765e4c4562ad83e53e91d364 /src/config.rs | |
parent | 78325aaccbfff24e4bca1ecc911b8ac44c015cca (diff) |
Update src/config.rs
Co-authored-by: Eric Huss <eric@huss.org>
Diffstat (limited to 'src/config.rs')
-rw-r--r-- | src/config.rs | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/config.rs b/src/config.rs index 2943cfea..e69493aa 100644 --- a/src/config.rs +++ b/src/config.rs @@ -321,16 +321,11 @@ impl<'de> Deserialize<'de> for Config { } }; - let book = if let Some(book) = table.remove("book") { - match book.try_into() { - Ok(b) => b, - Err(e) => { - return Err(D::Error::custom(e)); - } - } - } else { - BookConfig::default() - }; + let book: BookConfig = table + .remove("book") + .map(|book| book.try_into().map_err(D::Error::custom)) + .transpose()? + .unwrap_or_default(); let build = if let Some(build) = table.remove("build") { match build.try_into() { |