Skip to content

Commit

Permalink
Get rid of clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
rozhkovdmitrii committed May 2, 2023
1 parent eba2a8c commit f59ead6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 29 deletions.
33 changes: 7 additions & 26 deletions mm2src/mm2_main/src/lp_ordermatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3740,26 +3740,6 @@ struct TakerMatch {
last_updated: u64,
}

// impl<'a> From<TakerRequest> for TakerRequestForRpc {
// fn from(mut request: TakerRequest) -> TakerRequestForRpc {
// TakerRequestForRpc {
// base: request.base,
// rel: request.rel,
// base_amount: request.base_amount.to_decimal(),
// base_amount_rat: request.base_amount.to_ratio(),
// rel_amount: request.rel_amount.to_decimal(),
// rel_amount_rat: request.rel_amount.to_ratio(),
// action: request.action,
// uuid: take(&mut request.uuid),
// method: "request".to_string(),
// sender_pubkey: take(&mut request.sender_pubkey),
// dest_pub_key: take(&mut request.dest_pub_key),
// match_by: request.match_by.clone(),
// conf_settings: take(&mut request.conf_settings),
// }
// }
// }

impl<'a> From<&'a TakerRequest> for TakerRequestForRpc {
fn from(request: &'a TakerRequest) -> TakerRequestForRpc {
TakerRequestForRpc {
Expand All @@ -3769,13 +3749,13 @@ impl<'a> From<&'a TakerRequest> for TakerRequestForRpc {
base_amount_rat: request.base_amount.to_ratio(),
rel_amount: request.rel_amount.to_decimal(),
rel_amount_rat: request.rel_amount.to_ratio(),
action: request.action.clone(),
uuid: request.uuid.clone(),
action: request.action,
uuid: request.uuid,
method: "request".to_string(),
sender_pubkey: request.sender_pubkey.clone(),
dest_pub_key: request.dest_pub_key.clone(),
sender_pubkey: request.sender_pubkey,
dest_pub_key: request.dest_pub_key,
match_by: request.match_by.clone(),
conf_settings: request.conf_settings.clone(),
conf_settings: request.conf_settings,
}
}
}
Expand Down Expand Up @@ -3842,7 +3822,7 @@ pub async fn lp_auto_buy(

let result = json!(MmProtocolResult::new(LpautobuyResult {
request: (&order.request).into(),
order_type: order.order_type.clone(),
order_type: order.order_type,
min_volume: order.min_volume.clone().into(),
base_orderbook_ticker: order.base_orderbook_ticker.clone(),
rel_orderbook_ticker: order.rel_orderbook_ticker.clone(),
Expand Down Expand Up @@ -5182,6 +5162,7 @@ impl<'a> From<&'a TakerOrder> for TakerOrderForRpc<'a> {
}
}

#[allow(clippy::large_enum_variant)]
#[derive(Serialize)]
#[serde(tag = "type", content = "order")]
enum OrderForRpc<'a> {
Expand Down
2 changes: 1 addition & 1 deletion mm2src/mm2_main/src/lp_swap/taker_swap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2384,7 +2384,7 @@ pub async fn taker_swap_trade_preimage(
let order_builder = TakerOrderBuilder::new(&base_coin, &rel_coin)
.with_base_amount(base_amount)
.with_rel_amount(rel_amount)
.with_action(action.clone())
.with_action(action)
.with_match_by(MatchBy::Any)
.with_conf_settings(conf_settings)
.with_sender_pubkey(H256Json::from(our_public_id.bytes));
Expand Down
4 changes: 2 additions & 2 deletions mm2src/mm2_main/tests/mm2_tests/mm2_tests_inner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use http::{HeaderMap, StatusCode};
use mm2_main::mm2::lp_ordermatch::MIN_ORDER_KEEP_ALIVE_INTERVAL;
use mm2_metrics::{MetricType, MetricsJson};
use mm2_number::{BigDecimal, BigRational, Fraction, MmNumber};
use mm2_rpc::legacy::{OrderbookResponse, VersionResponse};
use mm2_rpc::legacy::{MmVersionResponse, OrderbookResponse};
use mm2_test_helpers::electrums::*;
use mm2_test_helpers::for_tests::{btc_segwit_conf, btc_with_spv_conf, btc_with_sync_starting_header,
check_recent_swaps, enable_eth_coin, enable_qrc20, eth_jst_testnet_conf,
Expand Down Expand Up @@ -82,7 +82,7 @@ fn test_rpc() {
.unwrap();
assert_eq!(version.0, StatusCode::OK);
assert_eq!((version.2)[ACCESS_CONTROL_ALLOW_ORIGIN], "http://localhost:4000");
let _version: VersionResponse = json::from_str(&version.1).unwrap();
let _version: MmVersionResponse = json::from_str(&version.1).unwrap();

let help = block_on(mm.rpc(&json! ({
"userpass": mm.userpass,
Expand Down

0 comments on commit f59ead6

Please sign in to comment.