diff --git a/examples/single_mem_node/main.rs b/examples/single_mem_node/main.rs index 8ef7c578..c60637f4 100644 --- a/examples/single_mem_node/main.rs +++ b/examples/single_mem_node/main.rs @@ -6,7 +6,6 @@ use std::sync::mpsc::{self, RecvTimeoutError}; use std::thread; use std::time::{Duration, Instant}; -use raft::eraftpb::ConfState; use raft::prelude::*; use raft::storage::MemStorage; diff --git a/harness/tests/integration_cases/test_raft.rs b/harness/tests/integration_cases/test_raft.rs index 180cc5e8..3b73287c 100644 --- a/harness/tests/integration_cases/test_raft.rs +++ b/harness/tests/integration_cases/test_raft.rs @@ -21,7 +21,7 @@ use std::panic::{self, AssertUnwindSafe}; use harness::*; use protobuf::Message as PbMessage; use raft::eraftpb::*; -use raft::storage::{GetEntriesContext, MemStorage}; +use raft::storage::MemStorage; use raft::*; use raft_proto::*; use slog::Logger; @@ -5301,7 +5301,7 @@ fn test_election_with_priority_log() { (false, false, true, 1, 1, 3, 1, StateRole::Leader), ]; - for (_i, &(l1, l2, l3, p1, p2, p3, id, state)) in tests.iter().enumerate() { + for &(l1, l2, l3, p1, p2, p3, id, state) in tests.iter() { let l = default_logger(); let mut n1 = new_test_raft(1, vec![1, 2, 3], 10, 1, new_storage(), &l); let mut n2 = new_test_raft(2, vec![1, 2, 3], 10, 1, new_storage(), &l); diff --git a/harness/tests/integration_cases/test_raw_node.rs b/harness/tests/integration_cases/test_raw_node.rs index a310bd2a..5cea3f55 100644 --- a/harness/tests/integration_cases/test_raw_node.rs +++ b/harness/tests/integration_cases/test_raw_node.rs @@ -17,7 +17,7 @@ use harness::Network; use protobuf::{Message as PbMessage, ProtobufEnum as _}; use raft::eraftpb::*; -use raft::storage::{GetEntriesContext, MemStorage}; +use raft::storage::MemStorage; use raft::*; use raft_proto::*; use slog::Logger; diff --git a/src/raft.rs b/src/raft.rs index 44bea42a..30f18930 100644 --- a/src/raft.rs +++ b/src/raft.rs @@ -15,7 +15,6 @@ // limitations under the License. use std::cmp; -use std::convert::TryFrom; use std::ops::{Deref, DerefMut}; use crate::eraftpb::{ @@ -24,8 +23,8 @@ use crate::eraftpb::{ }; use protobuf::Message as _; use raft_proto::ConfChangeI; -use rand::{self, Rng}; -use slog::{self, Logger}; +use rand::Rng; +use slog::Logger; #[cfg(feature = "failpoints")] use fail::fail_point; @@ -285,9 +284,7 @@ impl DerefMut for Raft { } } -trait AssertSend: Send {} - -impl AssertSend for Raft {} +impl Raft {} fn new_message(to: u64, field_type: MessageType, from: Option) -> Message { let mut m = Message::default(); diff --git a/src/raft_log.rs b/src/raft_log.rs index 2024ba60..dfff305c 100644 --- a/src/raft_log.rs +++ b/src/raft_log.rs @@ -1084,7 +1084,7 @@ mod test { fn test_unstable_ents() { let l = default_logger(); let previous_ents = vec![new_entry(1, 1), new_entry(2, 2)]; - let tests = vec![(3, vec![]), (1, previous_ents.clone())]; + let tests = [(3, vec![]), (1, previous_ents.clone())]; for (i, &(unstable, ref wents)) in tests.iter().enumerate() { // append stable entries to storage @@ -1668,7 +1668,7 @@ mod test { #[test] fn test_compaction() { let l = default_logger(); - let tests = vec![ + let tests = [ // out of upper bound (1000, vec![1001u64], vec![0usize], true), (