Apply clippy suggestions

This commit is contained in:
Dirkjan Ochtman 2023-01-23 15:13:36 +01:00
parent cb4ded8f51
commit 24d3148720
2 changed files with 5 additions and 5 deletions

View File

@ -25,7 +25,7 @@ fn process_bigrams(word_list: &HashSet<SmartString>) {
.into_par_iter()
.map(|part| {
let fname = format!("data/cache/eng-2-{:05}-{:05}.txt", part, BIGRAM_PARTS);
let f = File::open(&fname).unwrap();
let f = File::open(fname).unwrap();
let mut reader = BufReader::with_capacity(4 * 1024 * 1024, f);
let mut ln = String::new();
@ -124,7 +124,7 @@ fn process_unigrams(word_list: &HashSet<SmartString>) {
.into_par_iter()
.map(|part| {
let fname = format!("data/cache/eng-1-{:05}-{:05}.txt", part, UNIGRAM_PARTS);
let f = File::open(&fname).unwrap();
let f = File::open(fname).unwrap();
let mut reader = BufReader::with_capacity(4 * 1024 * 1024, f);
let mut ln = String::new();

View File

@ -128,7 +128,7 @@ impl<'a> SegmentState<'a> {
0 => (None, 0.0),
_ => {
let prefix = self.search.candidates[split - 1];
let word = &self.text[split - prefix.len as usize..split];
let word = &self.text[split - prefix.len..split];
(Some(word), prefix.score)
}
};
@ -152,10 +152,10 @@ impl<'a> SegmentState<'a> {
let mut end = self.text.len();
let mut best = self.search.candidates[end - 1];
loop {
let word = &self.text[end - best.len as usize..end];
let word = &self.text[end - best.len..end];
self.search.result.push(word.into());
end -= best.len as usize;
end -= best.len;
if end == 0 {
break;
}