Skip to content

Commit

Permalink
pin to tag of pre-commit hook, fix some clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
logannc committed Sep 24, 2020
1 parent 5125045 commit 1c26173
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repos:
- id: detect-private-key
- id: no-commit-to-branch
- repo: https://github.com/doublify/pre-commit-rust
rev: master
rev: v1.0
hooks:
- id: fmt
- id: cargo-check
Expand Down
14 changes: 6 additions & 8 deletions src/fuzz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,36 +109,34 @@ fn token_set(s1: &str, s2: &str, partial: bool, force_ascii: bool, full_process:
let intersect_str = intersection.join(" ");
let diff1to2_str = diff1to2.join(" ");
let diff2to1_str = diff2to1.join(" ");
let combined_1to2 = if diff1to2_str.len() > 0 {
let combined_1to2 = if !diff1to2_str.is_empty() {
intersect_str.to_string() + &diff1to2_str
} else {
intersect_str.to_string()
};
let combined_2to1 = if diff2to1_str.len() > 0 {
let combined_2to1 = if !diff2to1_str.is_empty() {
intersect_str.to_string() + &diff2to1_str
} else {
intersect_str.to_string()
};
if partial {
vec![
*vec![
partial_ratio(&intersect_str, &combined_1to2),
partial_ratio(&intersect_str, &combined_2to1),
partial_ratio(&combined_1to2, &combined_2to1),
]
.iter()
.max()
.unwrap()
.clone()
} else {
vec![
*vec![
ratio(&intersect_str, &combined_1to2),
ratio(&intersect_str, &combined_2to1),
ratio(&combined_1to2, &combined_2to1),
]
.iter()
.max()
.unwrap()
.clone()
}
}

Expand Down Expand Up @@ -231,15 +229,15 @@ pub fn wratio(s1: &str, s2: &str, force_ascii: bool, full_process: bool) -> u8 {
return vec![base as f64, partial, ptsor, ptser]
.iter()
.cloned()
.fold(0. / 0., f64::max)
.fold(f64::NAN, f64::max)
.round() as u8;
}
let tsor = token_sort_ratio(p1r, p2r, true, false) as f64 * UNBASE_SCALE;
let tser = token_set_ratio(p1r, p2r, true, false) as f64 * UNBASE_SCALE;
vec![base as f64, tsor, tser]
.iter()
.cloned()
.fold(0. / 0., f64::max)
.fold(f64::NAN, f64::max)
.round() as u8
}

Expand Down

0 comments on commit 1c26173

Please sign in to comment.