Skip to content

Commit

Permalink
refactor: simplify hashmap usage
Browse files Browse the repository at this point in the history
  • Loading branch information
vlourme committed Sep 2, 2023
1 parent dded767 commit cdf50e1
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,7 @@ impl Solver {
}

let mut matching: Option<char> = None;
self.training_data.iter().for_each(|(key, value)| {
if key == &binary {
matching = Some(*value)
}
});
self.training_data.get(&binary).map(|letter| matching = Some(*letter));

if let Some(letter) = matching {
result.push(letter);
Expand Down

0 comments on commit cdf50e1

Please sign in to comment.