Skip to content

Commit

Permalink
Fix a few clippy warnings and imports
Browse files Browse the repository at this point in the history
  • Loading branch information
n1t0 committed Aug 13, 2021
1 parent 542999b commit 9538bde
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tokenizers/src/models/wordlevel/trainer.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use super::WordLevel;
use crate::utils::parallelism::*;
use crate::{AddedToken, Result, Trainer};
use std::cmp::Ordering;
use std::collections::HashMap;

#[non_exhaustive]
Expand Down Expand Up @@ -43,12 +44,12 @@ impl WordLevelTrainer {

//sort the word counts first by inverse counts and then by word, in order
//to keep the sorting deterministic in case of equal counts
let cmp = |l: &(&String, &u32), r: &(&String, &u32)| -> std::cmp::Ordering {
let count_comp: std::cmp::Ordering = l.1.cmp(&r.1);
if count_comp != Equal {
let cmp = |l: &(&String, &u32), r: &(&String, &u32)| -> Ordering {
let count_comp: Ordering = l.1.cmp(r.1);
if count_comp != Ordering::Equal {
return count_comp.reverse();
}
return l.0.cmp(&r.0);
l.0.cmp(r.0)
};

ordered_counts.sort_by(cmp);
Expand Down

0 comments on commit 9538bde

Please sign in to comment.