Skip to content

Commit

Permalink
Fix clippy violations (#540)
Browse files Browse the repository at this point in the history
Signed-off-by: git-hulk <[email protected]>
  • Loading branch information
git-hulk authored Mar 27, 2024
1 parent 65a0062 commit 91cd291
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 12 deletions.
1 change: 0 additions & 1 deletion examples/single_mem_node/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions harness/tests/integration_cases/test_raft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion harness/tests/integration_cases/test_raw_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 3 additions & 6 deletions src/raft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// limitations under the License.

use std::cmp;
use std::convert::TryFrom;
use std::ops::{Deref, DerefMut};

use crate::eraftpb::{
Expand All @@ -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;
Expand Down Expand Up @@ -285,9 +284,7 @@ impl<T: Storage> DerefMut for Raft<T> {
}
}

trait AssertSend: Send {}

impl<T: Storage + Send> AssertSend for Raft<T> {}
impl<T: Storage + Send> Raft<T> {}

fn new_message(to: u64, field_type: MessageType, from: Option<u64>) -> Message {
let mut m = Message::default();
Expand Down
4 changes: 2 additions & 2 deletions src/raft_log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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),
(
Expand Down

0 comments on commit 91cd291

Please sign in to comment.