Skip to content

Commit

Permalink
Avoid unwrap on cache access
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Jun 20, 2023
1 parent fde5dbc commit 2abf257
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions crates/ruff_cli/src/commands/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,7 @@ pub(crate) fn run(

let settings = resolver.resolve_all(path, pyproject_config);
let package_root = package.unwrap_or_else(|| path.parent().unwrap_or(path));
let cache = caches
.as_ref()
.map(|caches| caches.get(&package_root).unwrap());
let cache = caches.as_ref().and_then(|caches| caches.get(&package_root));

lint_path(path, package, settings, cache, noqa, autofix).map_err(|e| {
(Some(path.to_owned()), {
Expand Down

0 comments on commit 2abf257

Please sign in to comment.