Skip to content

Commit

Permalink
Fix clippy (#491)
Browse files Browse the repository at this point in the history
Signed-off-by: Arnaud Gourlay <[email protected]>
  • Loading branch information
agourlay authored Oct 9, 2022
1 parent 7293f8a commit 36d3293
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion examples/single_mem_node/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ fn on_ready(raft_group: &mut RawNode<MemStorage>, cbs: &mut HashMap<u8, ProposeC
}

if entry.get_entry_type() == EntryType::EntryNormal {
if let Some(cb) = cbs.remove(entry.data.get(0).unwrap()) {
if let Some(cb) = cbs.remove(entry.data.first().unwrap()) {
cb();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/quorum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::collections::HashMap;
use std::fmt::{self, Debug, Display, Formatter};

/// VoteResult indicates the outcome of a vote.
#[derive(Clone, Copy, Debug, PartialEq)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum VoteResult {
/// Pending indicates that the decision of the vote depends on future
/// votes, i.e. neither "yes" or "no" has reached quorum yet.
Expand Down
2 changes: 1 addition & 1 deletion src/quorum/joint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::cmp;

/// A configuration of two groups of (possibly overlapping) majority configurations.
/// Decisions require the support of both majorities.
#[derive(Clone, Debug, Default, PartialEq)]
#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub struct Configuration {
pub(crate) incoming: MajorityConfig,
pub(crate) outgoing: MajorityConfig,
Expand Down
2 changes: 1 addition & 1 deletion src/quorum/majority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::ops::{Deref, DerefMut};
use std::{cmp, slice, u64};

/// A set of IDs that uses majority quorums to make decisions.
#[derive(Clone, Debug, Default, PartialEq)]
#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub struct Configuration {
voters: HashSet<u64>,
}
Expand Down
4 changes: 2 additions & 2 deletions src/raft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub const CAMPAIGN_ELECTION: &[u8] = b"CampaignElection";
pub const CAMPAIGN_TRANSFER: &[u8] = b"CampaignTransfer";

/// The role of the node.
#[derive(Debug, PartialEq, Clone, Copy)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum StateRole {
/// The node is a follower of the leader.
Follower,
Expand All @@ -82,7 +82,7 @@ pub const INVALID_INDEX: u64 = 0;

/// SoftState provides state that is useful for logging and debugging.
/// The state is volatile and does not need to be persisted to the WAL.
#[derive(Default, PartialEq, Debug)]
#[derive(Default, PartialEq, Eq, Debug)]
pub struct SoftState {
/// The potential leader of the cluster.
pub leader_id: u64,
Expand Down
2 changes: 1 addition & 1 deletion src/raw_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub struct Peer {
}

/// The status of the snapshot.
#[derive(Debug, PartialEq, Copy, Clone)]
#[derive(Debug, PartialEq, Eq, Copy, Clone)]
pub enum SnapshotStatus {
/// Represents that the snapshot is finished being created.
Finish,
Expand Down
4 changes: 2 additions & 2 deletions src/read_only.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use crate::eraftpb::Message;
use crate::{HashMap, HashSet};

/// Determines the relative safety of and consistency of read only requests.
#[derive(Debug, PartialEq, Clone, Copy)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum ReadOnlyOption {
/// Safe guarantees the linearizability of the read only request by
/// communicating with the quorum. It is the default and suggested option.
Expand All @@ -46,7 +46,7 @@ impl Default for ReadOnlyOption {
/// this state from ready. It's also caller's duty to differentiate if this
/// state is what it requests through request_ctx, e.g. given a unique id as
/// request_ctx.
#[derive(Default, Debug, PartialEq, Clone)]
#[derive(Default, Debug, PartialEq, Eq, Clone)]
pub struct ReadState {
/// The index of the read state.
pub index: u64,
Expand Down
2 changes: 1 addition & 1 deletion src/tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use getset::Getters;
use std::fmt::Debug;

/// Config reflects the configuration tracked in a ProgressTracker.
#[derive(Clone, Debug, Default, PartialEq, Getters)]
#[derive(Clone, Debug, Default, PartialEq, Eq, Getters)]
pub struct Configuration {
#[get = "pub"]
pub(crate) voters: JointConfig,
Expand Down
2 changes: 1 addition & 1 deletion src/tracker/inflights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use std::cmp::Ordering;

/// A buffer of inflight messages.
#[derive(Debug, PartialEq, Clone)]
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct Inflights {
// the starting index in the buffer
start: usize,
Expand Down
2 changes: 1 addition & 1 deletion src/tracker/progress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{Inflights, ProgressState, INVALID_INDEX};
use std::cmp;

/// The progress of catching up from a restart.
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Progress {
/// How much state is matched.
pub matched: u64,
Expand Down
2 changes: 1 addition & 1 deletion src/tracker/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use std::fmt;
use std::fmt::{Display, Formatter};

/// The state of the progress.
#[derive(Debug, PartialEq, Clone, Copy)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum ProgressState {
/// Whether it's probing.
Probe,
Expand Down

0 comments on commit 36d3293

Please sign in to comment.