Skip to content

Commit

Permalink
Dep: upgrade toolchain to nightly-2023-10-17
Browse files Browse the repository at this point in the history
upgrade thiserror, fix lint warnings.
  • Loading branch information
drmingdrmer committed Oct 18, 2023
1 parent e2a7ba4 commit f697b5f
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ rand = "0.8"
serde = { version="1.0.114", features=["derive", "rc"]}
serde_json = "1.0.57"
tempfile = { version = "3.4.0" }
thiserror = "1.0.33"
thiserror = "1.0.49"
tokio = { version="1.8", default-features=false, features=["fs", "io-util", "macros", "rt", "rt-multi-thread", "sync", "time"] }
tracing = { version = "0.1.29" }
tracing-appender = "0.2.0"
Expand Down
1 change: 0 additions & 1 deletion openraft/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![doc = include_str!("../README.md")]
#![cfg_attr(feature = "bt", feature(error_generic_member_access))]
#![cfg_attr(feature = "bt", feature(provide_any))]
#![cfg_attr(feature = "bench", feature(test))]
// TODO: `clippy::result-large-err`: StorageError is 136 bytes, try to reduce the size.
#![allow(clippy::bool_assert_comparison, clippy::type_complexity, clippy::result_large_err)]
Expand Down
22 changes: 11 additions & 11 deletions openraft/src/progress/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ mod t {
#[test]
fn vec_progress_new() -> anyhow::Result<()> {
let quorum_set: Vec<u64> = vec![0, 1, 2, 3, 4];
let progress = VecProgress::<u64, u64, u64, _>::new(quorum_set, [6, 7].into_iter(), 0);
let progress = VecProgress::<u64, u64, u64, _>::new(quorum_set, [6, 7], 0);

assert_eq!(
vec![
Expand All @@ -393,7 +393,7 @@ mod t {
#[test]
fn vec_progress_get() -> anyhow::Result<()> {
let quorum_set: Vec<u64> = vec![0, 1, 2, 3, 4];
let mut progress = VecProgress::<u64, u64, u64, _>::new(quorum_set, [6, 7].into_iter(), 0);
let mut progress = VecProgress::<u64, u64, u64, _>::new(quorum_set, [6, 7], 0);

let _ = progress.update(&6, 5);
assert_eq!(&5, progress.get(&6));
Expand All @@ -414,7 +414,7 @@ mod t {
#[test]
fn vec_progress_iter() -> anyhow::Result<()> {
let quorum_set: Vec<u64> = vec![0, 1, 2, 3, 4];
let mut progress = VecProgress::<u64, u64, u64, _>::new(quorum_set, [6, 7].into_iter(), 0);
let mut progress = VecProgress::<u64, u64, u64, _>::new(quorum_set, [6, 7], 0);

let _ = progress.update(&7, 7);
let _ = progress.update(&3, 3);
Expand All @@ -441,10 +441,10 @@ mod t {
#[test]
fn vec_progress_move_up() -> anyhow::Result<()> {
let quorum_set: Vec<u64> = vec![0, 1, 2, 3, 4];
let mut progress = VecProgress::<u64, u64, u64, _>::new(quorum_set, [6].into_iter(), 0);
let mut progress = VecProgress::<u64, u64, u64, _>::new(quorum_set, [6], 0);

// initial: 0-0, 1-0, 2-0, 3-0, 4-0
let cases = vec![
let cases = [
((1, 2), &[(1, 2), (0, 0), (2, 0), (3, 0), (4, 0), (6, 0)], 0), //
((2, 3), &[(2, 3), (1, 2), (0, 0), (3, 0), (4, 0), (6, 0)], 0), //
((1, 3), &[(2, 3), (1, 3), (0, 0), (3, 0), (4, 0), (6, 0)], 1), // no move
Expand Down Expand Up @@ -473,7 +473,7 @@ mod t {
#[test]
fn vec_progress_update() -> anyhow::Result<()> {
let quorum_set: Vec<u64> = vec![0, 1, 2, 3, 4];
let mut progress = VecProgress::<u64, u64, u64, _>::new(quorum_set, [6].into_iter(), 0);
let mut progress = VecProgress::<u64, u64, u64, _>::new(quorum_set, [6], 0);

// initial: 0,0,0,0,0
let cases = vec![
Expand Down Expand Up @@ -515,10 +515,10 @@ mod t {
let pv = |p, user_data| ProgressEntry { progress: p, user_data };

let quorum_set: Vec<u64> = vec![0, 1, 2];
let mut progress = VecProgress::<u64, ProgressEntry, u64, _>::new(quorum_set, [3].into_iter(), pv(0, "foo"));
let mut progress = VecProgress::<u64, ProgressEntry, u64, _>::new(quorum_set, [3], pv(0, "foo"));

// initial: 0,0,0,0
let cases = vec![
let cases = [
(3, pv(9, "a"), Ok(&0)), // 0,0,0,9 // learner won't affect granted
(1, pv(2, "b"), Ok(&0)), // 0,2,0,9
(2, pv(3, "c"), Ok(&2)), // 0,2,3,9
Expand All @@ -543,7 +543,7 @@ mod t {
#[test]
fn vec_progress_update_does_not_move_learner_elt() -> anyhow::Result<()> {
let quorum_set: Vec<u64> = vec![0, 1, 2, 3, 4];
let mut progress = VecProgress::<u64, u64, u64, _>::new(quorum_set, [6].into_iter(), 0);
let mut progress = VecProgress::<u64, u64, u64, _>::new(quorum_set, [6], 0);

assert_eq!(Some(5), progress.index(&6));

Expand All @@ -563,7 +563,7 @@ mod t {

// Initially, committed is 5

let mut p012 = VecProgress::<u64, u64, u64, _>::new(qs012, [5].into_iter(), 0);
let mut p012 = VecProgress::<u64, u64, u64, _>::new(qs012, [5], 0);

let _ = p012.update(&0, 5);
let _ = p012.update(&1, 6);
Expand Down Expand Up @@ -597,7 +597,7 @@ mod t {
#[test]
fn vec_progress_is_voter() -> anyhow::Result<()> {
let quorum_set: Vec<u64> = vec![0, 1, 2, 3, 4];
let progress = VecProgress::<u64, u64, u64, _>::new(quorum_set, [6, 7].into_iter(), 0);
let progress = VecProgress::<u64, u64, u64, _>::new(quorum_set, [6, 7], 0);

assert_eq!(Some(true), progress.is_voter(&1));
assert_eq!(Some(true), progress.is_voter(&3));
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2023-06-01
nightly-2023-10-17
2 changes: 1 addition & 1 deletion tests/tests/snapshot_streaming/t10_api_install_snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async fn snapshot_arguments() -> Result<()> {

let n = router.remove_node(0).ok_or_else(|| anyhow::anyhow!("node not found"))?;
let make_req = || InstallSnapshotRequest {
/// force it to be a follower
// force it to be a follower
vote: Vote::new_committed(2, 1),
meta: SnapshotMeta {
snapshot_id: "ss1".into(),
Expand Down

0 comments on commit f697b5f

Please sign in to comment.