Skip to content

Commit

Permalink
Updates code due to range API change
Browse files Browse the repository at this point in the history
  • Loading branch information
0x7CFE committed Jan 25, 2017
1 parent 5fde448 commit 700f05c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ impl<'a> Dictionary<'a> {
// Finding best entry to merge-in the new value
// TODO Optimize the case when at least threshold bits_set
if let Some((key, value, _)) = self.map
.range_mut(Excluded(&lower_bound), Included(&pending_key))
.range_mut((Excluded(&lower_bound), Included(&pending_key)))
.map(|(k, v)| (k, v, k.0.fuzzy_eq(&pending_key.0)))
.filter(|&(_, _, m)| m >= bit_threshold)
.max_by(|x, y| x.2.cmp(&y.2)) // max by matched_bits
Expand Down Expand Up @@ -409,7 +409,7 @@ impl<'a> Dictionary<'a> {
let bit_threshold = (key.0.bits_set as f32 / 100. * similarity as f32).round() as usize;

if let Some((_, value, _)) = self.map
.range(Excluded(&lower_bound), Included(&key))
.range((Excluded(&lower_bound), Included(key)))
.map(|(k, v)| (k, v, k.0.fuzzy_eq(&key.0)))
.filter(|&(_, _, m)| m >= bit_threshold)
.max_by(|x, y| x.2.cmp(&y.2)) // max by matched_bits
Expand Down

0 comments on commit 700f05c

Please sign in to comment.