summaryrefslogtreecommitdiffstats
path: root/src/config.rs
diff options
context:
space:
mode:
authorjosh rotenberg <joshrotenberg@gmail.com>2021-05-24 12:01:56 -0700
committerjosh rotenberg <joshrotenberg@gmail.com>2021-05-24 12:01:56 -0700
commit6b0b42ebcccc9ccdf85960bc761c4c0b001c7601 (patch)
tree07ba61afc16e36cf43027d23bba02410988d18ff /src/config.rs
parent7a3513200f0688009a209452617e3a61ca557051 (diff)
update build and rust config change
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs30
1 files changed, 10 insertions, 20 deletions
diff --git a/src/config.rs b/src/config.rs
index e69493aa..05ec31bb 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -327,27 +327,17 @@ impl<'de> Deserialize<'de> for Config {
.transpose()?
.unwrap_or_default();
- let build = if let Some(build) = table.remove("build") {
- match build.try_into() {
- Ok(b) => b,
- Err(e) => {
- return Err(D::Error::custom(e));
- }
- }
- } else {
- BuildConfig::default()
- };
+ let build: BuildConfig = table
+ .remove("build")
+ .map(|build| build.try_into().map_err(D::Error::custom))
+ .transpose()?
+ .unwrap_or_default();
- let rust = if let Some(rust) = table.remove("rust") {
- match rust.try_into() {
- Ok(b) => b,
- Err(e) => {
- return Err(D::Error::custom(e));
- }
- }
- } else {
- RustConfig::default()
- };
+ let rust: RustConfig = table
+ .remove("rust")
+ .map(|rust| rust.try_into().map_err(D::Error::custom))
+ .transpose()?
+ .unwrap_or_default();
Ok(Config {
book,