Skip to content

Commit

Permalink
clippy: allow dead_code for GraphVoteAccountModeError, DroppableTask …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
yihau authored May 13, 2024
1 parent 246e898 commit b42d8f6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ledger-tool/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ impl Default for GraphVoteAccountMode {
}
}

struct GraphVoteAccountModeError(String);
struct GraphVoteAccountModeError;

impl FromStr for GraphVoteAccountMode {
type Err = GraphVoteAccountModeError;
Expand All @@ -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),
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions program-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1007,6 +1007,14 @@ struct DroppableTask<T>(Arc<AtomicBool>, JoinHandle<T>);
impl<T> Drop for DroppableTask<T> {
fn drop(&mut self) {
self.0.store(true, Ordering::Relaxed);
trace!(
"stopping task, which is currently {}",
if self.1.is_finished() {
"finished"
} else {
"running"
}
);
}
}

Expand Down
3 changes: 3 additions & 0 deletions rpc/src/rpc_subscription_tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<SubscriptionTokenInner>, CounterToken);

Expand Down

0 comments on commit b42d8f6

Please sign in to comment.