Skip to content

Commit

Permalink
Remove unwrap()
Browse files Browse the repository at this point in the history
Refactor some code to remove an `unwrap()` call. The previous code was
also safe, because `is_ok()` was checked before calling `unwrap()`, but
the new version is more maintainable.
  • Loading branch information
aag committed Dec 1, 2024
1 parent 355401e commit a3a3312
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/files_watcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,8 @@ impl FilesWatcher {
}

for path in event.paths.iter() {
let actions = self.watches.get(path);
if actions.is_some() {
for action in actions.unwrap() {
if let Some(actions) = self.watches.get(path) {
for action in actions {
if action.handle_change(&event).is_ok() {
num_actions += 1;
}
Expand Down

0 comments on commit a3a3312

Please sign in to comment.