Convert len() > 0 to ! is_empty()

`cargo clippy` suggested to use `is_empty()` instead of `len() > 0`,
because this doesn't require to calculate the whole length of the sequence.

See: <https://rust-lang.github.io/rust-clippy/master/index.html#len_zero>
This commit is contained in:
Jörg Sommer
2019-06-07 22:18:01 +02:00
committed by Jan Alexander Steffens (heftig)
parent f9d3570363
commit 846ec8f898

View File

@@ -255,7 +255,7 @@ fn main() {
sg sg
) )
.unwrap(); .unwrap();
if new_entry.state_map.len() > 0 { if !new_entry.state_map.is_empty() {
writeln!(output, "INSERT INTO state_groups_state (state_group, room_id, type, state_key, event_id) VALUES").unwrap(); writeln!(output, "INSERT INTO state_groups_state (state_group, room_id, type, state_key, event_id) VALUES").unwrap();
let mut first = true; let mut first = true;
for ((t, s), e) in new_entry.state_map.iter() { for ((t, s), e) in new_entry.state_map.iter() {