Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
CAGS295 committed Sep 8, 2024
1 parent 5c0d00a commit 0554274
Showing 1 changed file with 17 additions and 23 deletions.
40 changes: 17 additions & 23 deletions src/limit_order_book/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub mod protos {
impl From<NativeLOB> for LimitOrderBook {
fn from(og: NativeLOB) -> Self {
LimitOrderBook {
update_id: og.update_id as u64,
update_id: og.update_id,
bids: Some(Bids {
bids: og
.bids
Expand Down Expand Up @@ -54,31 +54,25 @@ pub mod protos {
} = book;

let bids: super::Bids = bids
.map_or_else(
|| vec![],
|bids| {
bids.bids
.into_iter()
.map(|PriceAndQuantity { price, quantity }| {
super::PriceAndQuantity(price, quantity)
})
.collect()
},
)
.map_or_else(std::vec::Vec::new, |bids| {
bids.bids
.into_iter()
.map(|PriceAndQuantity { price, quantity }| {
super::PriceAndQuantity(price, quantity)
})
.collect()
})
.into();

let asks: super::Asks = asks
.map_or_else(
|| vec![],
|asks| {
asks.asks
.into_iter()
.map(|PriceAndQuantity { price, quantity }| {
super::PriceAndQuantity(price, quantity)
})
.collect()
},
)
.map_or_else(std::vec::Vec::new, |asks| {
asks.asks
.into_iter()
.map(|PriceAndQuantity { price, quantity }| {
super::PriceAndQuantity(price, quantity)
})
.collect()
})
.into();

Self {
Expand Down

0 comments on commit 0554274

Please sign in to comment.