Fix clippy::single_match_else (pedantic)

https://rust-lang.github.io/rust-clippy/master/index.html#single_match_else

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
Anders Kaseorg 2022-11-21 19:18:33 -08:00 committed by Charlie Marsh
parent 9cf4621071
commit 0bb8b14ae1
2 changed files with 9 additions and 10 deletions

View file

@ -101,8 +101,8 @@ pub fn iter_python_files<'a>(
true
}
}
Err(_) => {
debug!("Ignored path due to error in parsing: {:?}", path);
Err(e) => {
debug!("Ignored path due to error in parsing: {:?}: {}", path, e);
true
}
}

View file

@ -81,16 +81,15 @@ pub fn find_project_root(sources: &[PathBuf]) -> Option<PathBuf> {
}
pub fn load_options(pyproject: Option<&PathBuf>) -> Result<Options> {
match pyproject {
Some(pyproject) => Ok(parse_pyproject_toml(pyproject)?
if let Some(pyproject) = pyproject {
Ok(parse_pyproject_toml(pyproject)?
.tool
.and_then(|tool| tool.ruff)
.unwrap_or_default()),
None => {
debug!("No pyproject.toml found.");
debug!("Falling back to default configuration...");
Ok(Options::default())
}
.unwrap_or_default())
} else {
debug!("No pyproject.toml found.");
debug!("Falling back to default configuration...");
Ok(Options::default())
}
}