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:
parent
b36070b3e3
commit
482cdd4046
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in New Issue