From b42d8f68a46cb7a708cb885839764c21dcf731d0 Mon Sep 17 00:00:00 2001 From: Yihau Chen Date: Mon, 13 May 2024 10:45:37 +0800 Subject: [PATCH] clippy: allow dead_code for GraphVoteAccountModeError, DroppableTask and SubscriptionToken (#1246) * clippy: allow dead_code for SubscriptionToken * clippy: allow dead_code for GraphVoteAccountModeError * clippy: allow dead_code for DroppableTask * remove the string in the GraphVoteAccountModeError * abort the joinhandle when drop * only trace JoinHandle in the drop * add comment --- ledger-tool/src/main.rs | 4 ++-- program-test/src/lib.rs | 8 ++++++++ rpc/src/rpc_subscription_tracker.rs | 3 +++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ledger-tool/src/main.rs b/ledger-tool/src/main.rs index 7db720c34668fc..adda2e4b937359 100644 --- a/ledger-tool/src/main.rs +++ b/ledger-tool/src/main.rs @@ -170,7 +170,7 @@ impl Default for GraphVoteAccountMode { } } -struct GraphVoteAccountModeError(String); +struct GraphVoteAccountModeError; impl FromStr for GraphVoteAccountMode { type Err = GraphVoteAccountModeError; @@ -179,7 +179,7 @@ impl FromStr for GraphVoteAccountMode { Self::DISABLED => Ok(Self::Disabled), Self::LAST_ONLY => Ok(Self::LastOnly), Self::WITH_HISTORY => Ok(Self::WithHistory), - _ => Err(GraphVoteAccountModeError(s.to_string())), + _ => Err(GraphVoteAccountModeError), } } } diff --git a/program-test/src/lib.rs b/program-test/src/lib.rs index ea8afc3f4970a8..c6103a7bfa5992 100644 --- a/program-test/src/lib.rs +++ b/program-test/src/lib.rs @@ -1007,6 +1007,14 @@ struct DroppableTask(Arc, JoinHandle); impl Drop for DroppableTask { fn drop(&mut self) { self.0.store(true, Ordering::Relaxed); + trace!( + "stopping task, which is currently {}", + if self.1.is_finished() { + "finished" + } else { + "running" + } + ); } } diff --git a/rpc/src/rpc_subscription_tracker.rs b/rpc/src/rpc_subscription_tracker.rs index 0d6c7a0c1020e2..d3949da24bf029 100644 --- a/rpc/src/rpc_subscription_tracker.rs +++ b/rpc/src/rpc_subscription_tracker.rs @@ -575,6 +575,9 @@ impl Drop for SubscriptionTokenInner { } } +// allowing dead code here to appease clippy, but unsure if/how the CounterToken is actually used. +// further investigation would be necessary before removing +#[allow(dead_code)] #[derive(Clone)] pub struct SubscriptionToken(Arc, CounterToken);