Skip to content

Commit

Permalink
Remove unused functions
Browse files Browse the repository at this point in the history
  • Loading branch information
alexliesenfeld committed Oct 15, 2023
1 parent be76fde commit 38bfc6d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 25 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

- name: Generate code coverage
run: |
cargo +nightly tarpaulin --verbose --workspace --timeout 120 --out Xml
cargo +nightly tarpaulin --verbose --workspace --all-features --timeout 120 --out Xml
- name: Upload to codecov.io
uses: codecov/codecov-action@v2
Expand Down
24 changes: 0 additions & 24 deletions src/server/matchers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,27 +76,3 @@ where
let actual = actual.map_or(String::new(), |x| x.to_string());
levenshtein::levenshtein(&expected, &actual)
}

pub(crate) fn distance_for_binary<A: AsRef<[u8]>, B: AsRef<[u8]>>(a: &Option<A>, b: &Option<B>) -> usize {
match (a, b) {
(Some(a_val), Some(b_val)) => {
let a_slice = a_val.as_ref();
let b_slice = b_val.as_ref();

let min_len = std::cmp::min(a_slice.len(), b_slice.len());
let max_len = std::cmp::max(a_slice.len(), b_slice.len());

let mut differing_bytes = max_len - min_len;
for i in 0..min_len {
if a_slice[i] != b_slice[i] {
differing_bytes += 1;
}
}

differing_bytes
},
(Some(a_val), None) => a_val.as_ref().len(),
(None, Some(b_val)) => b_val.as_ref().len(),
(None, None) => 0,
}
}

0 comments on commit 38bfc6d

Please sign in to comment.