From f05bb111c2e7dd77f2b34b82892bbfa8e6a063c1 Mon Sep 17 00:00:00 2001 From: Trinity Pointard Date: Fri, 9 Apr 2021 02:32:42 +0200 Subject: fix clippy warnings on util and rpc --- src/rpc/ring.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/rpc/ring.rs') diff --git a/src/rpc/ring.rs b/src/rpc/ring.rs index bffd7f1f..d371bb64 100644 --- a/src/rpc/ring.rs +++ b/src/rpc/ring.rs @@ -141,8 +141,7 @@ impl Ring { if i_round >= node_info.capacity { continue; } - for pos2 in *pos..q.len() { - let qv = q[pos2]; + for (pos2, &qv) in q.iter().enumerate().skip(*pos) { if partitions[qv].len() != rep { continue; } @@ -205,7 +204,7 @@ impl Ring { for (i, entry) in self.ring.iter().enumerate() { ret.push((i as u16, entry.location)); } - if ret.len() > 0 { + if !ret.is_empty() { assert_eq!(ret[0].1, [0u8; 32].into()); } @@ -234,6 +233,6 @@ impl Ring { assert_eq!(partition_top & PARTITION_MASK_U16, top & PARTITION_MASK_U16); assert!(n <= partition.nodes.len()); - partition.nodes[..n].iter().cloned().collect::>() + partition.nodes[..n].to_vec() } } -- cgit v1.2.3