Skip to content

Commit 9bd5e53

Browse files
committed
fix(clippy): use latest rust to fix clippy warnings in CI
These fixes will be in dev soon. Once this branch is merged with dev, they should disappear from this branch.
1 parent cb4d5b5 commit 9bd5e53

6 files changed

Lines changed: 13 additions & 25 deletions

File tree

mm2src/coins/lightning/ln_sql.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1104,7 +1104,7 @@ mod tests {
11041104
PaymentType::InboundPayment
11051105
};
11061106
let status_rng: u8 = rng.gen();
1107-
let status = if status_rng % 3 == 0 {
1107+
let status = if status_rng.is_multiple_of(3) {
11081108
HTLCStatus::Succeeded
11091109
} else if status_rng % 3 == 1 {
11101110
HTLCStatus::Pending

mm2src/coins/nft/storage/mod.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#[cfg(not(target_arch = "wasm32"))]
12
use crate::eth::EthTxFeeDetails;
23
use crate::nft::nft_structs::{
34
Chain, Nft, NftList, NftListFilters, NftTokenAddrId, NftTransferHistory, NftTransferHistoryFilters,
@@ -7,7 +8,10 @@ use async_trait::async_trait;
78
use ethereum_types::Address;
89
use mm2_err_handle::mm_error::MmResult;
910
use mm2_err_handle::mm_error::NotMmError;
10-
use mm2_number::{BigDecimal, BigUint};
11+
#[cfg(not(target_arch = "wasm32"))]
12+
use mm2_number::BigDecimal;
13+
use mm2_number::BigUint;
14+
#[cfg(not(target_arch = "wasm32"))]
1115
use serde::{Deserialize, Serialize};
1216
use std::collections::HashSet;
1317
use std::num::NonZeroUsize;
@@ -231,6 +235,7 @@ fn get_offset_limit(max: bool, limit: usize, page_number: Option<NonZeroUsize>,
231235

232236
/// `NftDetailsJson` structure contains immutable parameters that are not needed for queries.
233237
/// This is what `details_json` string contains in db table.
238+
#[cfg(not(target_arch = "wasm32"))]
234239
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
235240
pub(crate) struct NftDetailsJson {
236241
pub(crate) owner_of: Address,
@@ -241,6 +246,7 @@ pub(crate) struct NftDetailsJson {
241246

242247
/// `TransferDetailsJson` structure contains immutable parameters that are not needed for queries.
243248
/// This is what `details_json` string contains in db table.
249+
#[cfg(not(target_arch = "wasm32"))]
244250
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
245251
pub(crate) struct TransferDetailsJson {
246252
pub(crate) block_hash: Option<String>,

mm2src/mm2_bitcoin/keys/src/segwitaddress.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ mod tests {
193193
use Public;
194194

195195
fn hex_to_bytes(s: &str) -> Option<Vec<u8>> {
196-
if s.len() % 2 == 0 {
196+
if s.len().is_multiple_of(2) {
197197
(0..s.len())
198198
.step_by(2)
199199
.map(|i| s.get(i..i + 2).and_then(|sub| u8::from_str_radix(sub, 16).ok()))

mm2src/mm2_main/src/lp_ordermatch/simple_market_maker.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -204,21 +204,6 @@ pub enum StartSimpleMakerBotError {
204204
InternalError(String),
205205
}
206206

207-
#[derive(Debug, Deserialize, Display, Serialize, SerializeErrorType)]
208-
#[serde(tag = "error_type", content = "error_data")]
209-
pub enum SwapUpdateNotificationError {
210-
#[display(fmt = "{_0}")]
211-
MyRecentSwapsError(LatestSwapsErr),
212-
#[display(fmt = "Swap info not available")]
213-
SwapInfoNotAvailable,
214-
}
215-
216-
impl From<LatestSwapsErr> for SwapUpdateNotificationError {
217-
fn from(e: LatestSwapsErr) -> Self {
218-
SwapUpdateNotificationError::MyRecentSwapsError(e)
219-
}
220-
}
221-
222207
impl HttpStatusCode for StartSimpleMakerBotError {
223208
fn status_code(&self) -> StatusCode {
224209
match self {

mm2src/mm2_main/src/lp_stats.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use mm2_libp2p::application::request_response::network_info::NetworkInfoRequest;
1111
use mm2_libp2p::{encode_message, NetworkInfo, PeerId, RelayAddress, RelayAddressError};
1212
use mm2_net::ip_addr::ParseAddressError;
1313
use serde_json::{self as json, Value as Json};
14-
use std::collections::{HashMap, HashSet};
14+
use std::collections::HashSet;
1515
use std::convert::TryInto;
1616
use std::sync::Arc;
1717

@@ -182,11 +182,6 @@ pub async fn remove_node_from_version_stat(ctx: MmArc, req: Json) -> NodeVersion
182182
Ok("success".into())
183183
}
184184

185-
#[derive(Debug, Deserialize, Serialize)]
186-
struct Mm2VersionRes {
187-
nodes: HashMap<String, String>,
188-
}
189-
190185
fn process_get_version_request(ctx: MmArc) -> Result<Vec<u8>, String> {
191186
let response = ctx.mm_version().to_string();
192187
encode_message(&response).map_err(|e| e.to_string())

mm2src/mm2_test_helpers/src/for_tests.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use mm2_metrics::{MetricType, MetricsJson};
1818
use mm2_number::BigDecimal;
1919
use mm2_rpc::data::legacy::{BalanceResponse, ElectrumProtocol};
2020
use rand::Rng;
21-
use serde::{Deserialize, Serialize};
21+
use serde::Serialize;
2222
use serde_json::{self as json, json, Value as Json};
2323
use std::collections::HashMap;
2424
use std::convert::TryFrom;
@@ -41,6 +41,7 @@ cfg_native! {
4141
use futures::task::SpawnExt;
4242
use http::Request;
4343
use regex::Regex;
44+
use serde::Deserialize;
4445
use std::fs;
4546
use std::io::Write;
4647
use std::net::Ipv4Addr;
@@ -1844,6 +1845,7 @@ where
18441845
}
18451846
}
18461847

1848+
#[cfg(not(target_arch = "wasm32"))]
18471849
#[derive(Serialize, Deserialize, Debug)]
18481850
struct ToWaitForLogRe {
18491851
ctx: u32,

0 commit comments

Comments
 (0)