Skip to content

Commit

Permalink
fix clippy (#883)
Browse files Browse the repository at this point in the history
  • Loading branch information
malefooo authored and ktmlm committed Mar 15, 2023
1 parent 9ef234f commit bffae92
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 30 deletions.
9 changes: 2 additions & 7 deletions src/components/config/src/findora/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,17 @@ pub mod init {
"https://prod-mainnet.prod.findora.org:26657/genesis";

#[allow(dead_code)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
#[derive(Debug, PartialEq, Eq, Clone, Copy, Default)]
pub enum InitMode {
Dev,
Testnet,
#[default]
Mainnet,
Qa01,
Qa02,
Qa03,
}

impl Default for InitMode {
fn default() -> Self {
InitMode::Mainnet
}
}

pub fn save_genesis(url: &str, path: &str) -> Result<()> {
let resp = attohttpc::get(url).send().c(d!())?;
if resp.is_success() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer};
use std::fmt;

/// Represents rpc api block number param.
#[derive(Debug, PartialEq, Clone, Hash, Eq)]
#[derive(Debug, PartialEq, Clone, Hash, Eq, Default)]
pub enum BlockNumber {
/// Hash
Hash {
Expand All @@ -34,19 +34,14 @@ pub enum BlockNumber {
/// Number
Num(u64),
/// Latest block
#[default]
Latest,
/// Earliest block (genesis)
Earliest,
/// Pending block (being mined)
Pending,
}

impl Default for BlockNumber {
fn default() -> Self {
BlockNumber::Latest
}
}

impl<'a> Deserialize<'a> for BlockNumber {
fn deserialize<D>(deserializer: D) -> Result<BlockNumber, D::Error>
where
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,15 @@ pub enum Kind {
}

/// Subscription kind.
#[derive(Debug, PartialEq, Eq, Hash, Clone)]
#[derive(Debug, PartialEq, Eq, Hash, Clone, Default)]
pub enum Params {
/// No parameters passed.
#[default]
None,
/// Log parameters.
Logs(Filter),
}

impl Default for Params {
fn default() -> Self {
Params::None
}
}

impl<'a> Deserialize<'a> for Params {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Params, D::Error>
where
Expand Down
4 changes: 2 additions & 2 deletions src/ledger/src/data_model/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ impl XfrAddress {
// }
}

#[allow(clippy::derive_hash_xor_eq)]
#[allow(clippy::derived_hash_with_manual_eq)]
impl Hash for XfrAddress {
#[inline(always)]
fn hash<H: Hasher>(&self, state: &mut H) {
Expand All @@ -428,7 +428,7 @@ impl IssuerPublicKey {
// }
}

#[allow(clippy::derive_hash_xor_eq)]
#[allow(clippy::derived_hash_with_manual_eq)]
impl Hash for IssuerPublicKey {
#[inline(always)]
fn hash<H: Hasher>(&self, state: &mut H) {
Expand Down
9 changes: 2 additions & 7 deletions src/ledger/src/staking/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2332,22 +2332,17 @@ fn calculate_delegation_rewards(
}

#[allow(missing_docs)]
#[derive(Clone, Copy, Debug, Serialize, Deserialize, Eq, PartialEq)]
#[derive(Clone, Copy, Debug, Serialize, Deserialize, Eq, PartialEq, Default)]
pub enum DelegationState {
/// during delegation, include extra 21 days
#[default]
Bond,
/// it's time to pay principals and rewards
Free,
/// principals and rewards have been paid successfully
Paid,
}

impl Default for DelegationState {
fn default() -> Self {
DelegationState::Bond
}
}

#[allow(missing_docs)]
#[derive(Clone, Debug, Serialize, Deserialize, Eq, PartialEq)]
pub struct PartialUnDelegation {
Expand Down

0 comments on commit bffae92

Please sign in to comment.