`count()` iterates over the whole collection. Using `len()` instead, or
`.next().is_none()` when comparing to zero, should be faster.
}
fn get_entry(&mut self, key: &str) -> &mut (Vec<Event<'a>>, u16) {
- let new_id = self.footnotes.keys().count() + 1;
+ let new_id = self.footnotes.len() + 1;
let key = key.to_owned();
self.footnotes.entry(key).or_insert((Vec::new(), new_id as u16))
}
};
for fragment in docs {
- if fragment.doc.as_str().lines().count() == 0 {
+ if fragment.doc.as_str().lines().next().is_none() {
continue;
}