Skip to content

Commit

Permalink
Chore: fix feature specific lint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
drmingdrmer committed Oct 14, 2024
1 parent 77d40a2 commit 8dffed0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
6 changes: 2 additions & 4 deletions examples/raft-kv-memstore/tests/cluster/test_cluster.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::backtrace::Backtrace;
use std::collections::BTreeMap;
#[allow(deprecated)] // since nightly 1.82
use std::panic::PanicInfo;
use std::panic::PanicHookInfo;
use std::thread;
use std::time::Duration;

Expand All @@ -14,8 +13,7 @@ use raft_kv_memstore::store::Request;
use tokio::runtime::Runtime;
use tracing_subscriber::EnvFilter;

#[allow(deprecated)] // PanicInfo deprecated since nightly 1.82
pub fn log_panic(panic: &PanicInfo) {
pub fn log_panic(panic: &PanicHookInfo) {
let backtrace = {
format!("{:?}", Backtrace::force_capture())
// #[cfg(feature = "bt")]
Expand Down
8 changes: 4 additions & 4 deletions openraft/src/core/tick.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ where C: RaftTypeConfig
}
}

// AsyncRuntime::spawn is `spawn_local` with singlethreaded enabled.
// It will result in a panic:
// `spawn_local` called from outside of a `task::LocalSet`.
#[cfg(not(feature = "singlethreaded"))]
#[cfg(test)]
mod tests {
use std::io::Cursor;
Expand All @@ -181,10 +185,6 @@ mod tests {
type Responder = crate::impls::OneshotResponder<Self>;
}

// AsyncRuntime::spawn is `spawn_local` with singlethreaded enabled.
// It will result in a panic:
// `spawn_local` called from outside of a `task::LocalSet`.
#[cfg(not(feature = "singlethreaded"))]
#[tokio::test]
async fn test_shutdown() -> anyhow::Result<()> {
let (tx, mut rx) = TickUTConfig::mpsc_unbounded();
Expand Down
2 changes: 1 addition & 1 deletion openraft/src/network/snapshot_transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ pub trait SnapshotTransport<C: RaftTypeConfig> {
///
/// - The receiving state `streaming` is maintained by the caller.
/// - And it depends on `Raft::begin_receiving_snapshot()` to create a `SnapshotData` for
/// receiving data.
/// receiving data.
///
/// Example usage:
/// ```ignore
Expand Down
4 changes: 2 additions & 2 deletions openraft/src/network/v2/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ where C: RaftTypeConfig
/// [`Raft::handle_transfer_leader()`]: crate::raft::Raft::handle_transfer_leader
#[since(version = "0.10.0")]
async fn transfer_leader(&mut self, _req: TransferLeaderRequest<C>, _option: RPCOption) -> Result<(), RPCError<C>> {
return Err(RPCError::Unreachable(Unreachable::new(&AnyError::error(
Err(RPCError::Unreachable(Unreachable::new(&AnyError::error(
"transfer_leader not implemented",
))));
))))
}

/// Build a backoff instance if the target node is temporarily(or permanently) unreachable.
Expand Down

0 comments on commit 8dffed0

Please sign in to comment.