Apply clippy suggestions
This commit is contained in:
parent
9d89c58b41
commit
fbe7b9ad75
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue