From e75697300bbc60ab3bb7e5b28817062abd0b4648 Mon Sep 17 00:00:00 2001 From: teor Date: Tue, 21 Jul 2020 14:09:19 +1000 Subject: [PATCH] fix: Remove some dead code lints --- zebra-consensus/src/chain.rs | 9 ++------- zebra-consensus/src/checkpoint.rs | 19 +++++++------------ 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/zebra-consensus/src/chain.rs b/zebra-consensus/src/chain.rs index c3b3657d4..c1af6ffae 100644 --- a/zebra-consensus/src/chain.rs +++ b/zebra-consensus/src/chain.rs @@ -133,10 +133,8 @@ where /// them to `init_from_verifiers`. // // TODO: revise this interface when we generate our own blocks, or validate -// mempool transactions. -// -// Only used by tests and other modules -#[allow(dead_code)] +// mempool transactions. We might want to share the BlockVerifier, and we +// might not want to add generated blocks to the state. pub fn init( network: Network, state_service: S, @@ -176,9 +174,6 @@ where /// verifiers (and the result be shared, cloning if needed). Constructing /// multiple services from the same underlying state might cause synchronisation /// bugs. -// -// Only used by tests and other modules -#[allow(dead_code)] pub fn init_from_verifiers( block_verifier: BV, // We use an explcit type, so callers can't accidentally swap the verifiers diff --git a/zebra-consensus/src/checkpoint.rs b/zebra-consensus/src/checkpoint.rs index 790fe1b36..d4859656e 100644 --- a/zebra-consensus/src/checkpoint.rs +++ b/zebra-consensus/src/checkpoint.rs @@ -117,11 +117,6 @@ impl CheckpointVerifier { /// than constructing multiple verification services for the same network. To /// Clone a CheckpointVerifier, you might need to wrap it in a /// `tower::Buffer` service. - // - // Avoid some dead code lints. - // Until we implement the overall verifier in #516, this function, and some of the - // functions and enum variants it uses, are only used in the tests. - #[allow(dead_code)] pub fn new(network: Network) -> Self { Self::from_checkpoint_list(CheckpointList::new(network)) } @@ -130,12 +125,11 @@ impl CheckpointVerifier { /// /// Assumes that the provided genesis checkpoint is correct. /// - /// See `CheckpointVerifier::new` and `CheckpointList::from_list` for more - /// details. + /// Callers should prefer `CheckpointVerifier::new`, which uses the + /// hard-coded checkpoint lists. See `CheckpointVerifier::new` and + /// `CheckpointList::from_list` for more details. // - // Avoid some dead code lints. - // Until we implement the overall verifier in #516, this function, and some of the - // functions and enum variants it uses, are only used in the tests. + // This function is designed for use in tests. #[allow(dead_code)] pub(crate) fn from_list( list: impl IntoIterator, @@ -145,8 +139,9 @@ impl CheckpointVerifier { /// Return a checkpoint verification service using `checkpoint_list`. /// - /// See `CheckpointVerifier::new` and `CheckpointList::from_list` for more - /// details. + /// Callers should prefer `CheckpointVerifier::new`, which uses the + /// hard-coded checkpoint lists. See `CheckpointVerifier::new` and + /// `CheckpointList::from_list` for more details. pub(crate) fn from_checkpoint_list(checkpoint_list: CheckpointList) -> Self { // All the initialisers should call this function, so we only have to // change fields or default values in one place.