Skip to content

Commit

Permalink
fix clippy warning
Browse files Browse the repository at this point in the history
  • Loading branch information
lichuang committed Jan 2, 2022
1 parent 78e016f commit cd5a570
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 15 deletions.
4 changes: 2 additions & 2 deletions async-raft/src/core/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ impl<'a, D: AppData, R: AppDataResponse, N: RaftNetwork<D>, S: RaftStorage<D, R>

// TODO(xp): 111 test adding a node that is not non-voter.
// TODO(xp): 111 test adding a node that is lagging.
for new_node in members.difference(&self.core.effective_membership.membership.get_ith_config(0).unwrap()) {
match self.nodes.get(&new_node) {
for new_node in members.difference(self.core.effective_membership.membership.get_ith_config(0).unwrap()) {
match self.nodes.get(new_node) {
// Node is ready to join.
Some(node) => {
if node.is_line_rate(&self.core.last_log_id, &self.core.config) {
Expand Down
2 changes: 1 addition & 1 deletion async-raft/src/core/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ impl<'a, D: AppData, R: AppDataResponse, N: RaftNetwork<D>, S: RaftStorage<D, R>
pub(super) async fn client_request_post_commit(&mut self, req: ClientRequestEntry<D, R>) {
let entry = &req.entry;

let apply_res = self.apply_entry_to_state_machine(&entry).await;
let apply_res = self.apply_entry_to_state_machine(entry).await;

self.send_response(entry, apply_res, req.tx).await;

Expand Down
1 change: 0 additions & 1 deletion async-raft/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![doc = include_str!("../README.md")]
#![feature(backtrace)]
#![feature(bound_cloned)]

pub mod config;
mod core;
Expand Down
1 change: 1 addition & 0 deletions async-raft/src/raft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,7 @@ impl Membership {
Membership::new_single(btreeset! {id})
}

#[must_use]
pub fn to_final_config(&self) -> Self {
assert!(!self.configs.is_empty());

Expand Down
4 changes: 2 additions & 2 deletions async-raft/tests/add_remove_voter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,15 @@ async fn wait_log(router: std::sync::Arc<fixtures::RaftRouter>, node_ids: &BTree
for i in node_ids.iter() {
router
.wait_for_metrics(
&i,
i,
|x| x.last_log_index == want_log,
Some(timeout),
&format!("n{}.last_log_index -> {}", i, want_log),
)
.await?;
router
.wait_for_metrics(
&i,
i,
|x| x.last_applied == want_log,
Some(timeout),
&format!("n{}.last_applied -> {}", i, want_log),
Expand Down
4 changes: 2 additions & 2 deletions async-raft/tests/concurrent_write_and_add_non_voter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,15 @@ async fn wait_log(
for i in node_ids.iter() {
router
.wait_for_metrics(
&i,
i,
|x| x.last_log_index == want_log,
Some(timeout),
&format!("n{}.last_log_index -> {}", i, want_log),
)
.await?;
router
.wait_for_metrics(
&i,
i,
|x| x.last_applied == want_log,
Some(timeout),
&format!("n{}.last_applied -> {}", i, want_log),
Expand Down
6 changes: 2 additions & 4 deletions async-raft/tests/membership/t30_commit_joint_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,13 @@ async fn commit_joint_config_during_0_to_012() -> Result<()> {
let router = Arc::new(RaftRouter::new(config.clone()));
router.new_raft_node(0).await;

// Assert all nodes are in non-voter state & have no entries.
let want;

// router.assert_pristine_cluster().await;

// Initialize the cluster, then assert that a stable cluster was formed & held.
tracing::info!("--- initializing cluster");
router.initialize_from_single_node(0).await?;
want = 1;
// Assert all nodes are in non-voter state & have no entries.
let want = 1;

router.wait_for_log(&btreeset![0], want, None, "init node 0").await?;

Expand Down
4 changes: 2 additions & 2 deletions async-raft/tests/membership/t40_removed_follower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ async fn stop_replication_to_removed_follower() -> Result<()> {

for i in &[0, 3, 4] {
router
.wait(&i, timeout())
.wait(i, timeout())
.await?
.metrics(|x| x.last_applied >= n_logs, "new cluster recv new logs")
.await?;
Expand All @@ -59,7 +59,7 @@ async fn stop_replication_to_removed_follower() -> Result<()> {

for i in &[1, 2] {
router
.wait(&i, timeout())
.wait(i, timeout())
.await?
.metrics(|x| x.last_applied < n_logs, "old cluster does not recv new logs")
.await?;
Expand Down
1 change: 0 additions & 1 deletion memstore/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![doc = include_str!("../README.md")]
#![feature(backtrace)]
#![feature(bound_cloned)]

#[cfg(test)]
mod test;
Expand Down

0 comments on commit cd5a570

Please sign in to comment.