refactor(config): Be more direct

This commit is contained in:
Ed Page 2024-07-25 13:40:48 -05:00
parent 626b4f71db
commit 95f556a918

View file

@ -60,12 +60,12 @@ impl Config {
if path.file_name().unwrap() == PYPROJECT_TOML { if path.file_name().unwrap() == PYPROJECT_TOML {
let config = toml::from_str::<PyprojectTomlConfig>(&s)?; let config = toml::from_str::<PyprojectTomlConfig>(&s)?;
if config.tool.typos.is_none() { if let Some(typos) = config.tool.typos {
Ok(Some(typos))
} else {
log::debug!("No `tool.typos` section found in `{PYPROJECT_TOML}`, skipping"); log::debug!("No `tool.typos` section found in `{PYPROJECT_TOML}`, skipping");
Ok(None) Ok(None)
} else {
Ok(config.tool.typos)
} }
} else { } else {
Self::from_toml(&s).map(Some) Self::from_toml(&s).map(Some)