diff options
| author | Brad Clawsie <brad@b7j0c.org> | 2026-11-25 14:32:46 -0600 |
|---|---|---|
| committer | Brad Clawsie <brad@b7j0c.org> | 2026-11-25 14:32:46 -0600 |
| commit | dfab0cabdac6603176ab4a5ec58e56d535ceb93b (patch) | |
| tree | 52ea5ed66b1e5e43074504733cde62172423290f /learn_21/src/config.rs | |
| parent | 7757056c7a43d4fbd85e3e817237d178bf6b1761 (diff) | |
fix: learn_21
Diffstat (limited to 'learn_21/src/config.rs')
| -rw-r--r-- | learn_21/src/config.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/learn_21/src/config.rs b/learn_21/src/config.rs index e0f21c4..a99441a 100644 --- a/learn_21/src/config.rs +++ b/learn_21/src/config.rs @@ -92,11 +92,11 @@ pub fn parse_config(input: &str) -> Result<Config, ConfigError> { if workers.is_none() { return Err(ConfigError::MissingField("workers".to_string())); } - - Ok(Config{ - host: host.unwrap(), - port: port.unwrap().get(), - workers: workers.unwrap().get(), + + Ok(Config { + host: host.ok_or_else(|| ConfigError::MissingField("host".into()))?, + port: port.ok_or_else(|| ConfigError::MissingField("port".into()))?.get(), + workers: workers.ok_or_else(|| ConfigError::MissingField("workers".into()))?.get(), }) } |
