Skip to content

Commit

Permalink
Fix clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
cjdsellers committed Apr 14, 2024
1 parent 4d5b508 commit 3d3ec20
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions nautilus_core/backtest/src/matching_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,26 +153,32 @@ impl OrderMatchingEngine {
info!("Reset {}", self.instrument.id());
}

#[must_use]
pub fn best_bid_price(&self) -> Option<Price> {
self.book.best_bid_price()
}

#[must_use]
pub fn best_ask_price(&self) -> Option<Price> {
self.book.best_ask_price()
}

#[must_use]
pub fn get_book(&self) -> &OrderBook {
&self.book
}

#[must_use]
pub fn get_open_bid_orders(&self) -> &[PassiveOrderType] {
self.core.get_orders_bid()
}

#[must_use]
pub fn get_open_ask_orders(&self) -> &[PassiveOrderType] {
self.core.get_orders_ask()
}

#[must_use]
pub fn order_exists(&self, client_order_id: ClientOrderId) -> bool {
self.core.order_exists(client_order_id)
}
Expand Down
1 change: 1 addition & 0 deletions nautilus_core/model/src/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,7 @@ pub enum RecordFlag {

impl RecordFlag {
/// Checks if the flag matches a given value.
#[must_use]
pub fn matches(self, value: u8) -> bool {
(self as u8) & value != 0
}
Expand Down
6 changes: 6 additions & 0 deletions nautilus_core/model/src/orders/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,13 +300,15 @@ pub enum PassiveOrderType {
}

impl PassiveOrderType {
#[must_use]
pub fn is_closed(&self) -> bool {
match self {
Self::Limit(o) => o.is_closed(),
Self::Stop(o) => o.is_closed(),
}
}

#[must_use]
pub fn expire_time(&self) -> Option<UnixNanos> {
match self {
Self::Limit(o) => o.expire_time(),
Expand All @@ -333,6 +335,7 @@ pub enum LimitOrderType {
}

impl LimitOrderType {
#[must_use]
pub fn is_closed(&self) -> bool {
match self {
Self::Limit(o) => o.is_closed(),
Expand All @@ -342,6 +345,7 @@ impl LimitOrderType {
}
}

#[must_use]
pub fn expire_time(&self) -> Option<UnixNanos> {
match self {
Self::Limit(o) => o.expire_time,
Expand Down Expand Up @@ -374,6 +378,7 @@ pub enum StopOrderType {
}

impl StopOrderType {
#[must_use]
pub fn is_closed(&self) -> bool {
match self {
Self::LimitIfTouched(o) => o.is_closed(),
Expand All @@ -385,6 +390,7 @@ impl StopOrderType {
}
}

#[must_use]
pub fn expire_time(&self) -> Option<UnixNanos> {
match self {
Self::LimitIfTouched(o) => o.expire_time,
Expand Down

0 comments on commit 3d3ec20

Please sign in to comment.