Skip to content

Commit

Permalink
Chore: disable inline attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
drmingdrmer committed Jul 3, 2024
1 parent 6cbfdc6 commit a977378
Show file tree
Hide file tree
Showing 36 changed files with 139 additions and 70 deletions.
3 changes: 2 additions & 1 deletion cluster_benchmark/tests/benchmark/network.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! A minimized store with least cost for benchmarking Openraft.
#[cfg(feature = "bt")] use std::backtrace::Backtrace;
#[cfg(feature = "bt")]
use std::backtrace::Backtrace;
use std::collections::BTreeMap;
use std::collections::BTreeSet;
use std::sync::Arc;
Expand Down
3 changes: 2 additions & 1 deletion examples/raft-kv-memstore/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ pub mod app;
pub mod client;
pub mod network;
pub mod store;
#[cfg(test)] mod test;
#[cfg(test)]
mod test;

pub type NodeId = u64;

Expand Down
6 changes: 4 additions & 2 deletions openraft/src/config/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#[allow(clippy::module_inception)] mod config;
#[allow(clippy::module_inception)]
mod config;
mod error;

#[cfg(test)] mod config_test;
#[cfg(test)]
mod config_test;

pub use config::Config;
pub(crate) use config::RuntimeConfig;
Expand Down
3 changes: 2 additions & 1 deletion openraft/src/core/sm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub(crate) mod worker;

pub(crate) use command::Command;
pub(crate) use command::CommandPayload;
#[allow(unused_imports)] pub(crate) use command::CommandSeq;
#[allow(unused_imports)]
pub(crate) use command::CommandSeq;
pub(crate) use response::CommandResult;
pub(crate) use response::Response;
3 changes: 2 additions & 1 deletion openraft/src/display_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ pub(crate) mod display_instant;
pub(crate) mod display_option;
pub(crate) mod display_slice;

#[allow(unused_imports)] pub(crate) use display_instant::DisplayInstant;
#[allow(unused_imports)]
pub(crate) use display_instant::DisplayInstant;
pub(crate) use display_instant::DisplayInstantExt;
pub(crate) use display_option::DisplayOption;
pub(crate) use display_option::DisplayOptionExt;
Expand Down
18 changes: 12 additions & 6 deletions openraft/src/engine/handler/following_handler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,18 @@ use crate::RaftTypeConfig;
use crate::Snapshot;
use crate::StoredMembership;

#[cfg(test)] mod append_entries_test;
#[cfg(test)] mod commit_entries_test;
#[cfg(test)] mod do_append_entries_test;
#[cfg(test)] mod install_snapshot_test;
#[cfg(test)] mod truncate_logs_test;
#[cfg(test)] mod update_committed_membership_test;
#[cfg(test)]
mod append_entries_test;
#[cfg(test)]
mod commit_entries_test;
#[cfg(test)]
mod do_append_entries_test;
#[cfg(test)]
mod install_snapshot_test;
#[cfg(test)]
mod truncate_logs_test;
#[cfg(test)]
mod update_committed_membership_test;

/// Receive replication request and deal with them.
///
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
use std::sync::Arc;

use maplit::btreeset;
#[allow(unused_imports)] use pretty_assertions::assert_eq;
#[allow(unused_imports)] use pretty_assertions::assert_ne;
#[allow(unused_imports)] use pretty_assertions::assert_str_eq;
#[allow(unused_imports)]
use pretty_assertions::assert_eq;
#[allow(unused_imports)]
use pretty_assertions::assert_ne;
#[allow(unused_imports)]
use pretty_assertions::assert_str_eq;

use crate::engine::testing::UTConfig;
use crate::engine::Command;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
use std::sync::Arc;

use maplit::btreeset;
#[allow(unused_imports)] use pretty_assertions::assert_eq;
#[allow(unused_imports)] use pretty_assertions::assert_ne;
#[allow(unused_imports)] use pretty_assertions::assert_str_eq;
#[allow(unused_imports)]
use pretty_assertions::assert_eq;
#[allow(unused_imports)]
use pretty_assertions::assert_ne;
#[allow(unused_imports)]
use pretty_assertions::assert_str_eq;

use crate::engine::testing::UTConfig;
use crate::engine::Engine;
Expand Down
9 changes: 6 additions & 3 deletions openraft/src/engine/handler/leader_handler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ use crate::RaftLogId;
use crate::RaftState;
use crate::RaftTypeConfig;

#[cfg(test)] mod append_entries_test;
#[cfg(test)] mod get_read_log_id_test;
#[cfg(test)] mod send_heartbeat_test;
#[cfg(test)]
mod append_entries_test;
#[cfg(test)]
mod get_read_log_id_test;
#[cfg(test)]
mod send_heartbeat_test;

/// Handle leader operations.
///
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
use std::sync::Arc;

use maplit::btreeset;
#[allow(unused_imports)] use pretty_assertions::assert_eq;
#[allow(unused_imports)] use pretty_assertions::assert_ne;
#[allow(unused_imports)] use pretty_assertions::assert_str_eq;
#[allow(unused_imports)]
use pretty_assertions::assert_eq;
#[allow(unused_imports)]
use pretty_assertions::assert_ne;
#[allow(unused_imports)]
use pretty_assertions::assert_str_eq;

use crate::engine::testing::UTConfig;
use crate::engine::Command;
Expand Down
6 changes: 4 additions & 2 deletions openraft/src/engine/handler/log_handler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ use crate::LogIdOptionExt;
use crate::RaftState;
use crate::RaftTypeConfig;

#[cfg(test)] mod calc_purge_upto_test;
#[cfg(test)] mod purge_log_test;
#[cfg(test)]
mod calc_purge_upto_test;
#[cfg(test)]
mod purge_log_test;

/// Handle raft-log related operations
pub(crate) struct LogHandler<'x, C>
Expand Down
6 changes: 4 additions & 2 deletions openraft/src/engine/handler/replication_handler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ use crate::RaftState;
use crate::RaftTypeConfig;
use crate::ServerState;

#[cfg(test)] mod append_membership_test;
#[cfg(test)] mod update_matching_test;
#[cfg(test)]
mod append_membership_test;
#[cfg(test)]
mod update_matching_test;

/// Handle replication operations.
///
Expand Down
3 changes: 2 additions & 1 deletion openraft/src/engine/handler/server_state_handler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ use crate::RaftState;
use crate::RaftTypeConfig;
use crate::ServerState;

#[cfg(test)] mod update_server_state_test;
#[cfg(test)]
mod update_server_state_test;

/// Handle raft server-state related operations
pub(crate) struct ServerStateHandler<'st, C>
Expand Down
6 changes: 4 additions & 2 deletions openraft/src/engine/handler/snapshot_handler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ use crate::RaftState;
use crate::RaftTypeConfig;
use crate::SnapshotMeta;

#[cfg(test)] mod trigger_snapshot_test;
#[cfg(test)] mod update_snapshot_test;
#[cfg(test)]
mod trigger_snapshot_test;
#[cfg(test)]
mod update_snapshot_test;

/// Handle raft vote related operations
pub(crate) struct SnapshotHandler<'st, 'out, C>
Expand Down
6 changes: 4 additions & 2 deletions openraft/src/engine/handler/vote_handler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ use crate::RaftState;
use crate::RaftTypeConfig;
use crate::Vote;

#[cfg(test)] mod accept_vote_test;
#[cfg(test)] mod handle_message_vote_test;
#[cfg(test)]
mod accept_vote_test;
#[cfg(test)]
mod handle_message_vote_test;

/// Handle raft vote related operations
///
Expand Down
3 changes: 2 additions & 1 deletion openraft/src/engine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ mod tests {
mod startup_test;
mod trigger_purge_log_test;
}
#[cfg(test)] pub(crate) mod testing;
#[cfg(test)]
pub(crate) mod testing;

pub(crate) use command::Command;
pub(crate) use command::Condition;
Expand Down
9 changes: 6 additions & 3 deletions openraft/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ pub(crate) mod type_config;
pub(crate) mod utime;

pub mod async_runtime;
#[cfg(feature = "compat")] pub mod compat;
#[cfg(feature = "compat")]
pub mod compat;
pub mod docs;
pub mod entry;
pub mod error;
Expand All @@ -63,7 +64,8 @@ pub mod raft;
pub mod storage;
pub mod testing;

#[cfg(test)] mod feature_serde_test;
#[cfg(test)]
mod feature_serde_test;

pub use anyerror;
pub use anyerror::AnyError;
Expand Down Expand Up @@ -115,7 +117,8 @@ pub use crate::storage_error::ToStorageResult;
pub use crate::storage_error::Violation;
pub use crate::summary::MessageSummary;
pub use crate::try_as_ref::TryAsRef;
#[cfg(feature = "type-alias")] pub use crate::type_config::alias;
#[cfg(feature = "type-alias")]
pub use crate::type_config::alias;
pub use crate::type_config::RaftTypeConfig;
pub use crate::vote::CommittedLeaderId;
pub use crate::vote::LeaderId;
Expand Down
9 changes: 6 additions & 3 deletions openraft/src/membership/mod.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
mod effective_membership;
mod into_nodes;
#[allow(clippy::module_inception)] mod membership;
#[allow(clippy::module_inception)]
mod membership;
mod stored_membership;

#[cfg(feature = "bench")]
#[cfg(test)]
mod bench;

#[cfg(test)] mod effective_membership_test;
#[cfg(test)] mod membership_test;
#[cfg(test)]
mod effective_membership_test;
#[cfg(test)]
mod membership_test;

pub use effective_membership::EffectiveMembership;
pub use into_nodes::IntoNodes;
Expand Down
3 changes: 2 additions & 1 deletion openraft/src/metrics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ mod wait;

mod metric_display;
mod wait_condition;
#[cfg(test)] mod wait_test;
#[cfg(test)]
mod wait_test;

use std::collections::BTreeMap;

Expand Down
3 changes: 2 additions & 1 deletion openraft/src/progress/entry/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,4 +280,5 @@ impl<NID: NodeId> Validate for ProgressEntry<NID> {
}
}

#[cfg(test)] mod tests;
#[cfg(test)]
mod tests;
3 changes: 2 additions & 1 deletion openraft/src/progress/inflight/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#[cfg(test)] mod tests;
#[cfg(test)]
mod tests;

use std::error::Error;
use std::fmt::Display;
Expand Down
3 changes: 2 additions & 1 deletion openraft/src/progress/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ use std::slice::Iter;
use std::slice::IterMut;

// TODO: remove it
#[allow(unused_imports)] pub(crate) use inflight::Inflight;
#[allow(unused_imports)]
pub(crate) use inflight::Inflight;

use crate::quorum::QuorumSet;

Expand Down
6 changes: 4 additions & 2 deletions openraft/src/quorum/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ mod quorum_set_impl;
#[cfg(test)]
mod bench;

#[cfg(test)] mod coherent_test;
#[cfg(test)] mod quorum_set_test;
#[cfg(test)]
mod coherent_test;
#[cfg(test)]
mod quorum_set_test;

pub(crate) use coherent::Coherent;
pub(crate) use coherent::FindCoherent;
Expand Down
3 changes: 2 additions & 1 deletion openraft/src/raft/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
//! This allows multiple components within the application that require interaction with `RaftCore`
//! to efficiently share access.
#[cfg(test)] mod declare_raft_types_test;
#[cfg(test)]
mod declare_raft_types_test;
mod external_request;
mod impl_raft_blocking_write;
pub(crate) mod message;
Expand Down
6 changes: 4 additions & 2 deletions openraft/src/raft_state/membership_state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ use crate::LogIdOptionExt;
use crate::RaftTypeConfig;

mod change_handler;
#[cfg(test)] mod change_handler_test;
#[cfg(test)] mod membership_state_test;
#[cfg(test)]
mod change_handler_test;
#[cfg(test)]
mod membership_state_test;

pub(crate) use change_handler::ChangeHandler;

Expand Down
3 changes: 2 additions & 1 deletion openraft/src/raft_state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ mod log_state_reader;
mod membership_state;
mod vote_state_reader;

#[allow(unused)] pub(crate) use io_state::log_io_id::LogIOId;
#[allow(unused)]
pub(crate) use io_state::log_io_id::LogIOId;
pub(crate) use io_state::IOState;

#[cfg(test)]
Expand Down
9 changes: 6 additions & 3 deletions openraft/src/timer/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
mod timeout;

// Not yet ready to publish :)
#[allow(unused_imports)] pub(crate) use timeout::RaftTimer;
#[allow(unused_imports)] pub(crate) use timeout::Timeout;
#[allow(unused_imports)]
pub(crate) use timeout::RaftTimer;
#[allow(unused_imports)]
pub(crate) use timeout::Timeout;

#[cfg(test)] mod timeout_test;
#[cfg(test)]
mod timeout_test;
15 changes: 10 additions & 5 deletions openraft/src/vote/leader_id/mod.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
#[cfg(not(feature = "single-term-leader"))] mod leader_id_adv;
#[cfg(feature = "single-term-leader")] mod leader_id_std;
#[cfg(not(feature = "single-term-leader"))]
mod leader_id_adv;
#[cfg(feature = "single-term-leader")]
mod leader_id_std;

#[cfg(not(feature = "single-term-leader"))]
pub use leader_id_adv::CommittedLeaderId;
#[cfg(not(feature = "single-term-leader"))] pub use leader_id_adv::LeaderId;
#[cfg(feature = "single-term-leader")] pub use leader_id_std::CommittedLeaderId;
#[cfg(feature = "single-term-leader")] pub use leader_id_std::LeaderId;
#[cfg(not(feature = "single-term-leader"))]
pub use leader_id_adv::LeaderId;
#[cfg(feature = "single-term-leader")]
pub use leader_id_std::CommittedLeaderId;
#[cfg(feature = "single-term-leader")]
pub use leader_id_std::LeaderId;

mod impl_into_leader_id;
3 changes: 2 additions & 1 deletion openraft/src/vote/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
mod leader_id;
#[allow(clippy::module_inception)] mod vote;
#[allow(clippy::module_inception)]
mod vote;

pub use leader_id::CommittedLeaderId;
pub use leader_id::LeaderId;
Expand Down
2 changes: 1 addition & 1 deletion rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ overflow_delimited_expr = true
wrap_comments = true
comment_width = 100
max_width = 120
inline_attribute_width = 80
inline_attribute_width = 0

merge_derives = false

Expand Down
Loading

0 comments on commit a977378

Please sign in to comment.