fix(clippy): Fix new lints in nightly clippy (#5959)
* Derive default using #[default] * Implement PartialEq manually to satisfy clippy * Allow a manual derive in test-only code * Fix some missing docs warnings in the Docker build
This commit is contained in:
parent
7e5253e27f
commit
256b1c0008
|
|
@ -10,8 +10,6 @@
|
|||
//!
|
||||
//! A root of a note commitment tree is associated with each treestate.
|
||||
|
||||
#![allow(clippy::derive_hash_xor_eq)]
|
||||
|
||||
use std::{
|
||||
fmt,
|
||||
hash::{Hash, Hasher},
|
||||
|
|
@ -99,7 +97,7 @@ lazy_static! {
|
|||
/// The root hash in LEBS2OSP256(rt) encoding of the Orchard note commitment
|
||||
/// tree corresponding to the final Orchard treestate of this block. A root of a
|
||||
/// note commitment tree is associated with each treestate.
|
||||
#[derive(Clone, Copy, Default, Eq, PartialEq, Serialize, Deserialize)]
|
||||
#[derive(Clone, Copy, Default, Eq, Serialize, Deserialize)]
|
||||
pub struct Root(#[serde(with = "serde_helpers::Base")] pub(crate) pallas::Base);
|
||||
|
||||
impl fmt::Debug for Root {
|
||||
|
|
@ -128,6 +126,13 @@ impl Hash for Root {
|
|||
}
|
||||
}
|
||||
|
||||
impl PartialEq for Root {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
// TODO: should we compare canonical forms here using `.to_repr()`?
|
||||
self.0 == other.0
|
||||
}
|
||||
}
|
||||
|
||||
impl TryFrom<[u8; 32]> for Root {
|
||||
type Error = SerializationError;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
use std::{convert::From, fmt, str::FromStr};
|
||||
//! Consensus parameters for each Zcash network.
|
||||
|
||||
use std::{fmt, str::FromStr};
|
||||
|
||||
use thiserror::Error;
|
||||
|
||||
|
|
@ -47,11 +49,13 @@ mod tests;
|
|||
const ZIP_212_GRACE_PERIOD_DURATION: i32 = 32_256;
|
||||
|
||||
/// An enum describing the possible network choices.
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Serialize, Deserialize)]
|
||||
#[derive(Copy, Clone, Debug, Default, Eq, PartialEq, Hash, Serialize, Deserialize)]
|
||||
#[cfg_attr(any(test, feature = "proptest-impl"), derive(Arbitrary))]
|
||||
pub enum Network {
|
||||
/// The production mainnet.
|
||||
#[default]
|
||||
Mainnet,
|
||||
|
||||
/// The testnet.
|
||||
Testnet,
|
||||
}
|
||||
|
|
@ -114,12 +118,6 @@ impl Network {
|
|||
}
|
||||
}
|
||||
|
||||
impl Default for Network {
|
||||
fn default() -> Self {
|
||||
Network::Mainnet
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for Network {
|
||||
type Err = InvalidNetworkError;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
use std::{
|
||||
cmp::{Ord, Ordering},
|
||||
convert::TryInto,
|
||||
net::SocketAddr,
|
||||
time::Instant,
|
||||
};
|
||||
|
||||
use chrono::Utc;
|
||||
|
||||
use zebra_chain::{parameters::Network, serialization::DateTime32};
|
||||
|
||||
use crate::{
|
||||
|
|
@ -80,6 +80,7 @@ impl PeerAddrState {
|
|||
|
||||
// non-test code should explicitly specify the peer address state
|
||||
#[cfg(test)]
|
||||
#[allow(clippy::derivable_impls)]
|
||||
impl Default for PeerAddrState {
|
||||
fn default() -> Self {
|
||||
NeverAttemptedGossiped
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
//! Tests for the [`zebra_test::command`] module.
|
||||
|
||||
use std::{process::Command, time::Duration};
|
||||
|
||||
use color_eyre::eyre::{eyre, Result};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
//! Tests for the [`zebra_test::transcript`] module.
|
||||
|
||||
use tower::{Service, ServiceExt};
|
||||
use zebra_test::transcript::ExpectedTranscriptError;
|
||||
use zebra_test::transcript::Transcript;
|
||||
|
||||
use zebra_test::transcript::{ExpectedTranscriptError, Transcript};
|
||||
|
||||
const TRANSCRIPT_DATA: [(&str, Result<&str, ExpectedTranscriptError>); 4] = [
|
||||
("req1", Ok("rsp1")),
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ fn cmd_output(cmd: &mut std::process::Command) -> Result<String> {
|
|||
Ok(s)
|
||||
}
|
||||
|
||||
/// Process entry point for `zebra-checkpoints`
|
||||
#[allow(clippy::print_stdout)]
|
||||
fn main() -> Result<()> {
|
||||
// initialise
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ fn disable_non_reproducible(_config: &mut Config) {
|
|||
*/
|
||||
}
|
||||
|
||||
/// Process entry point for `zebrad`'s build script
|
||||
#[allow(clippy::print_stderr)]
|
||||
fn main() {
|
||||
let mut config = Config::default();
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use zebrad::application::APPLICATION;
|
||||
|
||||
/// Boot Zebrad
|
||||
/// Process entry point for `zebrad`
|
||||
fn main() {
|
||||
abscissa_core::boot(&APPLICATION);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,27 +86,27 @@ type InboundTxDownloads = TxDownloads<Timeout<Outbound>, Timeout<TxVerifier>, St
|
|||
//
|
||||
// Zebra only has one mempool, so the enum variant size difference doesn't matter.
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
#[derive(Default)]
|
||||
enum ActiveState {
|
||||
/// The Mempool is disabled.
|
||||
#[default]
|
||||
Disabled,
|
||||
|
||||
/// The Mempool is enabled.
|
||||
Enabled {
|
||||
/// The Mempool storage itself.
|
||||
///
|
||||
/// ##: Correctness: only components internal to the [`Mempool`] struct are allowed to
|
||||
/// # Correctness
|
||||
///
|
||||
/// Only components internal to the [`Mempool`] struct are allowed to
|
||||
/// inject transactions into `storage`, as transactions must be verified beforehand.
|
||||
storage: storage::Storage,
|
||||
|
||||
/// The transaction download and verify stream.
|
||||
tx_downloads: Pin<Box<InboundTxDownloads>>,
|
||||
},
|
||||
}
|
||||
|
||||
impl Default for ActiveState {
|
||||
fn default() -> Self {
|
||||
ActiveState::Disabled
|
||||
}
|
||||
}
|
||||
|
||||
impl ActiveState {
|
||||
/// Returns the current state, leaving [`Self::Disabled`] in its place.
|
||||
fn take(&mut self) -> Self {
|
||||
|
|
|
|||
Loading…
Reference in New Issue