1
0
Fork 0
mirror of https://github.com/lise-henry/crowbook synced 2024-05-28 18:16:32 +02:00

no need to collect if it's not necessary

https://rust-lang.github.io/rust-clippy/master/index.html#needless_collect
This commit is contained in:
stefan0xC 2022-02-28 23:04:59 +01:00
parent b36070b3e3
commit 482cdd4046
2 changed files with 4 additions and 5 deletions

View File

@ -335,11 +335,11 @@ impl<'a> HtmlRenderer<'a> {
if i == self.current_chapter.len() - 1 {
break;
}
let bools: Vec<_> = self.current_chapter[i + 1..]
if !self.current_chapter[i + 1..]
.iter()
.map(|x| *x != 0)
.collect();
if !bools.contains(&true) {
.any(|x| x)
{
break;
}
}

View File

@ -112,8 +112,7 @@ impl Stats {
for c in &book.chapters {
let name = c.filename.clone();
let text = view_as_text(&c.content);
let words: Vec<_> = text.split_whitespace().collect();
let wc = words.len();
let wc = text.split_whitespace().count();
// Note: Don't count the bytes with `len()` count the actual (multibyte-)characters
let cc = text.chars().count();