Skip to content

Commit

Permalink
bless fmt
Browse files Browse the repository at this point in the history
Signed-off-by: onur-ozkan <work@onurozkan.dev>
  • Loading branch information
onur-ozkan committed Jun 25, 2024
1 parent ca2e903 commit d3778d0
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 79 deletions.
2 changes: 0 additions & 2 deletions mm2src/coins/coin_balance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,6 @@ pub enum EnableCoinScanPolicy {
Scan,
}



#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct EnabledCoinBalanceParams {
#[serde(default)]
Expand Down
53 changes: 19 additions & 34 deletions mm2src/coins/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2165,10 +2165,7 @@ impl MarketCoinOps for EthCoin {
let coin = self.clone();

let fut = async move {


coin
.send_raw_transaction(bytes.into())
coin.send_raw_transaction(bytes.into())
.await
.map(|res| format!("{:02x}", res))
.map_err(|e| ERRL!("{}", e))
Expand Down Expand Up @@ -3602,11 +3599,9 @@ impl EthCoin {
U256::from(gas_limit::ETH_SEND_ERC20),
)
},
EthCoinType::Nft { .. } => {
Box::new(futures01::future::err(TransactionErr::ProtocolNotSupported(ERRL!(
"Nft Protocol is not supported yet!"
))))
},
EthCoinType::Nft { .. } => Box::new(futures01::future::err(TransactionErr::ProtocolNotSupported(ERRL!(
"Nft Protocol is not supported yet!"
)))),
}
}

Expand Down Expand Up @@ -3767,11 +3762,9 @@ impl EthCoin {
}
}))
},
EthCoinType::Nft { .. } => {
Box::new(futures01::future::err(TransactionErr::ProtocolNotSupported(ERRL!(
"Nft Protocol is not supported yet!"
))))
},
EthCoinType::Nft { .. } => Box::new(futures01::future::err(TransactionErr::ProtocolNotSupported(ERRL!(
"Nft Protocol is not supported yet!"
)))),
}
}

Expand Down Expand Up @@ -3888,11 +3881,9 @@ impl EthCoin {
}),
)
},
EthCoinType::Nft { .. } => {
Box::new(futures01::future::err(TransactionErr::ProtocolNotSupported(ERRL!(
"Nft Protocol is not supported yet!"
))))
},
EthCoinType::Nft { .. } => Box::new(futures01::future::err(TransactionErr::ProtocolNotSupported(ERRL!(
"Nft Protocol is not supported yet!"
)))),
}
}

Expand Down Expand Up @@ -4013,11 +4004,9 @@ impl EthCoin {
}),
)
},
EthCoinType::Nft { .. } => {
Box::new(futures01::future::err(TransactionErr::ProtocolNotSupported(ERRL!(
"Nft Protocol is not supported yet!"
))))
},
EthCoinType::Nft { .. } => Box::new(futures01::future::err(TransactionErr::ProtocolNotSupported(ERRL!(
"Nft Protocol is not supported yet!"
)))),
}
}

Expand Down Expand Up @@ -4138,11 +4127,9 @@ impl EthCoin {
.compat()
.await
},
EthCoinType::Nft { .. } => {
Err(TransactionErr::ProtocolNotSupported(ERRL!(
"Nft Protocol is not supported!"
)))
},
EthCoinType::Nft { .. } => Err(TransactionErr::ProtocolNotSupported(ERRL!(
"Nft Protocol is not supported!"
))),
}
}

Expand Down Expand Up @@ -4263,11 +4250,9 @@ impl EthCoin {
.compat()
.await
},
EthCoinType::Nft { .. } => {
Err(TransactionErr::ProtocolNotSupported(ERRL!(
"Nft Protocol is not supported yet!"
)))
},
EthCoinType::Nft { .. } => Err(TransactionErr::ProtocolNotSupported(ERRL!(
"Nft Protocol is not supported yet!"
))),
}
}

Expand Down
10 changes: 2 additions & 8 deletions mm2src/coins/eth/v2_activation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,7 @@ impl From<EnableCoinBalanceError> for EthActivationV2Error {
}

/// An alternative to `crate::PrivKeyActivationPolicy`, typical only for ETH coin.
#[derive(Clone, Deserialize)]
#[derive(Default)]
#[derive(Clone, Deserialize, Default)]
pub enum EthPrivKeyActivationPolicy {
#[default]
ContextPrivKey,
Expand All @@ -156,23 +155,18 @@ pub enum EthPrivKeyActivationPolicy {
Metamask,
}



impl EthPrivKeyActivationPolicy {
pub fn is_hw_policy(&self) -> bool { matches!(self, EthPrivKeyActivationPolicy::Trezor) }
}

#[derive(Clone, Debug, Deserialize, Serialize)]
#[derive(Default)]
#[derive(Clone, Debug, Deserialize, Serialize, Default)]
pub enum EthRpcMode {
#[default]
Default,
#[cfg(target_arch = "wasm32")]
Metamask,
}



#[derive(Clone, Deserialize)]
pub struct EthActivationV2Request {
#[serde(default)]
Expand Down
3 changes: 1 addition & 2 deletions mm2src/coins/hd_wallet/coin_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,7 @@ pub trait HDWalletCoinOps {
chain: Bip44Chain,
) -> AddressDerivingResult<Vec<HDCoinHDAddress<Self>>> {
let known_addresses_number = hd_account.known_addresses_number(chain)?;
let address_ids = (0..known_addresses_number)
.map(|address_id| HDAddressId { chain, address_id });
let address_ids = (0..known_addresses_number).map(|address_id| HDAddressId { chain, address_id });
self.derive_addresses(hd_account, address_ids).await
}

Expand Down
10 changes: 2 additions & 8 deletions mm2src/coins/lp_coins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2434,8 +2434,7 @@ pub enum TradePreimageValue {
UpperBound(BigDecimal),
}

#[derive(Clone, Debug, Serialize, Deserialize)]
#[derive(Default)]
#[derive(Clone, Debug, Serialize, Deserialize, Default)]
pub enum SwapTxFeePolicy {
#[default]
Unsupported,
Expand All @@ -2445,8 +2444,6 @@ pub enum SwapTxFeePolicy {
High,
}



#[derive(Debug, Deserialize)]
pub struct SwapTxFeePolicyRequest {
coin: String,
Expand Down Expand Up @@ -3840,16 +3837,13 @@ impl CoinsContext {
}

/// This enum is used in coin activation requests.
#[derive(Copy, Clone, Debug, Deserialize, Serialize)]
#[derive(Default)]
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Default)]
pub enum PrivKeyActivationPolicy {
#[default]
ContextPrivKey,
Trezor,
}



impl PrivKeyActivationPolicy {
pub fn is_hw_policy(&self) -> bool { matches!(self, PrivKeyActivationPolicy::Trezor) }
}
Expand Down
5 changes: 1 addition & 4 deletions mm2src/coins/lp_price.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ struct TickerInfos {
change_24_h_provider: Provider,
}

#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[derive(Default)]
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
pub enum Provider {
#[serde(rename = "binance")]
Binance,
Expand All @@ -88,8 +87,6 @@ pub enum Provider {
Unknown,
}



#[derive(Default, Clone, Debug)]
pub struct RateInfos {
#[allow(dead_code)]
Expand Down
6 changes: 3 additions & 3 deletions mm2src/coins/my_tx_history_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,13 +268,13 @@ impl<'a, Addr: Clone + DisplayAddress + Eq + std::hash::Hash, Tx: Transaction> T
pub enum MyTxHistoryTarget {
#[default]
Iguana,
AccountId { account_id: u32 },
AccountId {
account_id: u32,
},
AddressId(HDPathAccountToAddressId),
AddressDerivationPath(StandardHDPath),
}



#[derive(Clone, Deserialize)]
pub struct MyTxHistoryRequestV2<T> {
pub(crate) coin: String,
Expand Down
5 changes: 1 addition & 4 deletions mm2src/mm2_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ pub mod data_asker;
pub mod event_dispatcher;
pub mod mm_ctx;

#[derive(Clone, Copy, Display, PartialEq)]
#[derive(Default)]
#[derive(Clone, Copy, Display, PartialEq, Default)]
pub enum DbNamespaceId {
#[display(fmt = "MAIN")]
#[default]
Expand All @@ -15,8 +14,6 @@ pub enum DbNamespaceId {
Test(u64),
}



impl DbNamespaceId {
pub fn for_test() -> DbNamespaceId {
let mut rng = thread_rng();
Expand Down
5 changes: 1 addition & 4 deletions mm2src/mm2_main/src/lp_stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,7 @@ pub fn process_info_request(ctx: MmArc, request: NetworkInfoRequest) -> Result<O
}
}

#[derive(PartialEq)]
#[derive(Default)]
#[derive(PartialEq, Default)]
enum StatsCollectionStatus {
Running,
Updating(f64),
Expand All @@ -198,8 +197,6 @@ enum StatsCollectionStatus {
Stopped,
}



#[cfg_attr(not(target_arch = "wasm32"), derive(Default))]
struct StatsContext {
pub status: AsyncMutex<StatsCollectionStatus>,
Expand Down
5 changes: 1 addition & 4 deletions mm2src/mm2_main/src/lp_swap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1625,8 +1625,7 @@ pub async fn active_swaps_rpc(ctx: MmArc, req: Json) -> Result<Response<Vec<u8>>
}

/// Algorithm used to hash swap secret.
#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
#[derive(Default)]
#[derive(Clone, Copy, Debug, Deserialize, Serialize, Default)]
pub enum SecretHashAlgo {
/// ripemd160(sha256(secret))
#[default]
Expand All @@ -1635,8 +1634,6 @@ pub enum SecretHashAlgo {
SHA256 = 2,
}



#[derive(Debug, Display)]
pub struct UnsupportedSecretHashAlgo(u8);

Expand Down
2 changes: 0 additions & 2 deletions mm2src/mm2_rpc/src/data/legacy/activation/utxo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ pub enum ElectrumProtocol {
}

#[cfg(not(target_arch = "wasm32"))]


#[cfg(target_arch = "wasm32")]
impl Default for ElectrumProtocol {
fn default() -> Self { ElectrumProtocol::WS }
Expand Down
4 changes: 0 additions & 4 deletions mm2src/mm2_rpc/src/data/legacy/orders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ pub enum OrderType {
GoodTillCancelled,
}



#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
#[serde(tag = "type", content = "data")]
#[derive(Default)]
Expand All @@ -93,8 +91,6 @@ pub enum MatchBy {
Pubkeys(HashSet<H256Json>),
}



#[derive(Serialize, Deserialize)]
pub struct OrderbookRequest {
pub base: String,
Expand Down

0 comments on commit d3778d0

Please sign in to comment.