Skip to content

Commit a8de5fd

Browse files
committed
Fix clippy lints
1 parent 5cf3777 commit a8de5fd

File tree

5 files changed

+19
-18
lines changed

5 files changed

+19
-18
lines changed

RELEASES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ None
2323
- Improved validations for `StopLimitOrder` in Rust (#2593), thanks @nicolad
2424
- Improved validations for `StopMarketOrder` in Rust (#2596), thanks @nicolad
2525
- Improved validations for `TrailingStopMarketOrder` in Rust (#2607), thanks @nicolad
26+
- Improved orders initialize and display tests in Rust (#2617), thanks @nicolad
2627
- Improved zero size trade logging for Binance Futures (#2588), thanks @bartolootrit
2728
- Implemented remaining Display for orders in Rust (#2614), thanks @nicolad
2829
- Refined `BacktestDataIterator` correctness (#2591), thanks @faysou

crates/data/src/engine/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ impl DataEngine {
394394
self.default_client.as_mut()
395395
}
396396

397+
#[must_use]
397398
pub fn get_clients(&self) -> Vec<&DataClientAdapter> {
398399
let (default_opt, clients_map) = (&self.default_client, &self.clients);
399400

crates/data/tests/client.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ fn test_bars_subscription(
523523
let bar_type: BarType = "AUDUSD.SIM-1-MINUTE-LAST-INTERNAL".into();
524524

525525
let sub = SubscribeCommand::Bars(SubscribeBars::new(
526-
bar_type.clone(),
526+
bar_type,
527527
Some(client_id),
528528
Some(venue),
529529
UUID4::new(),
@@ -539,7 +539,7 @@ fn test_bars_subscription(
539539
assert_eq!(adapter.subscriptions_bars.len(), 1);
540540

541541
let unsub = UnsubscribeCommand::Bars(UnsubscribeBars::new(
542-
bar_type.clone(),
542+
bar_type,
543543
Some(client_id),
544544
Some(venue),
545545
UUID4::new(),
@@ -1100,7 +1100,7 @@ fn test_bars_unsubscribe_noop(
11001100
let mut adapter = DataClientAdapter::new(client_id, Some(venue), false, false, client);
11011101
let bar_type: BarType = "AUDUSD.SIM-1-MINUTE-LAST-INTERNAL".into();
11021102
let unsub = UnsubscribeCommand::Bars(UnsubscribeBars::new(
1103-
bar_type.clone(),
1103+
bar_type,
11041104
Some(client_id),
11051105
Some(venue),
11061106
UUID4::new(),
@@ -1122,7 +1122,7 @@ fn test_bars_unsubscribe_idempotent(
11221122
let mut adapter = DataClientAdapter::new(client_id, Some(venue), false, false, client);
11231123
let bar_type: BarType = "AUDUSD.SIM-1-MINUTE-LAST-INTERNAL".into();
11241124
let sub = SubscribeCommand::Bars(SubscribeBars::new(
1125-
bar_type.clone(),
1125+
bar_type,
11261126
Some(client_id),
11271127
Some(venue),
11281128
UUID4::new(),
@@ -1132,7 +1132,7 @@ fn test_bars_unsubscribe_idempotent(
11321132
));
11331133
adapter.execute_subscribe(&sub);
11341134
let unsub = UnsubscribeCommand::Bars(UnsubscribeBars::new(
1135-
bar_type.clone(),
1135+
bar_type,
11361136
Some(client_id),
11371137
Some(venue),
11381138
UUID4::new(),
@@ -1379,7 +1379,7 @@ fn test_request_data(
13791379
let data_type = DataType::new("ReqType", None);
13801380
let req = RequestData {
13811381
client_id,
1382-
data_type: data_type.clone(),
1382+
data_type: data_type,
13831383
request_id: UUID4::new(),
13841384
ts_init: UnixNanos::default(),
13851385
params: None,

crates/data/tests/common/mocks.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
2020
// Under development
2121
#![allow(dead_code)]
22-
#![allow(unused_variables)]
2322

2423
use std::{cell::RefCell, rc::Rc};
2524

@@ -43,11 +42,11 @@ use nautilus_model::identifiers::{ClientId, Venue};
4342

4443
/// A mock implementation of [`DataClient`] for testing, with optional generic recorder.
4544
pub struct MockDataClient {
46-
clock: Rc<RefCell<dyn Clock>>,
47-
cache: Rc<RefCell<Cache>>,
4845
pub client_id: ClientId,
4946
pub venue: Option<Venue>,
5047
pub recorder: Option<Rc<RefCell<Vec<DataCommand>>>>,
48+
clock: Rc<RefCell<dyn Clock>>,
49+
cache: Rc<RefCell<Cache>>,
5150
}
5251

5352
impl MockDataClient {
@@ -68,7 +67,7 @@ impl MockDataClient {
6867
}
6968
}
7069

71-
/// Creates a new `MockDataClient` that records all DataCommands into the given recorder.
70+
/// Creates a new [`MockDataClient`] that records all `DataCommands` into the given recorder.
7271
#[must_use]
7372
pub fn new_with_recorder(
7473
clock: Rc<RefCell<dyn Clock>>,

crates/data/tests/engine.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,13 +1151,13 @@ fn test_request_data(
11511151
ts_init: UnixNanos::default(),
11521152
params: None,
11531153
};
1154-
let cmd = DataCommand::Request(RequestCommand::Data(req.clone()));
1154+
let cmd = DataCommand::Request(RequestCommand::Data(req));
11551155
send_request_cmd(
11561156
clock,
11571157
cache,
11581158
client_id,
11591159
venue,
1160-
&mut *eng,
1160+
&mut eng,
11611161
cmd.clone(),
11621162
&recorder,
11631163
);
@@ -1190,7 +1190,7 @@ fn test_request_instrument(
11901190
cache,
11911191
client_id,
11921192
venue,
1193-
&mut *eng,
1193+
&mut eng,
11941194
cmd.clone(),
11951195
&recorder,
11961196
);
@@ -1222,7 +1222,7 @@ fn test_request_instruments(
12221222
cache,
12231223
client_id,
12241224
venue,
1225-
&mut *eng,
1225+
&mut eng,
12261226
cmd.clone(),
12271227
&recorder,
12281228
);
@@ -1254,7 +1254,7 @@ fn test_request_book_snapshot(
12541254
cache,
12551255
client_id,
12561256
venue,
1257-
&mut *eng,
1257+
&mut eng,
12581258
cmd.clone(),
12591259
&recorder,
12601260
);
@@ -1288,7 +1288,7 @@ fn test_request_quotes(
12881288
cache,
12891289
client_id,
12901290
venue,
1291-
&mut *eng,
1291+
&mut eng,
12921292
cmd.clone(),
12931293
&recorder,
12941294
);
@@ -1322,7 +1322,7 @@ fn test_request_trades(
13221322
cache,
13231323
client_id,
13241324
venue,
1325-
&mut *eng,
1325+
&mut eng,
13261326
cmd.clone(),
13271327
&recorder,
13281328
);
@@ -1355,7 +1355,7 @@ fn test_request_bars(
13551355
cache,
13561356
client_id,
13571357
venue,
1358-
&mut *eng,
1358+
&mut eng,
13591359
cmd.clone(),
13601360
&recorder,
13611361
);

0 commit comments

Comments
 (0)