Skip to content

Commit

Permalink
refactor: simplify expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
kod-kristoff committed Mar 22, 2024
1 parent 492fb79 commit 260b183
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion auctioning_platform/auctions/tests/use_cases/bidding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ fn place_bid_uc(auction: Auction, auctions_repo: Arc<dyn AuctionsRepository>) ->
}

#[rstest]
fn first_bid_higher_than_intial_price_is_winning(
fn first_bid_higher_than_initial_price_is_winning(
auction: Auction,
auction_id: AuctionId,
auctions_repo: DynAuctionsRepository,
Expand Down
14 changes: 7 additions & 7 deletions auctioning_platform/auctions/tests/use_cases/in_memory_repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ use std::sync::Mutex;
pub struct InMemoryAuctionsRepo {
store: Mutex<HashMap<AuctionId, Auction>>,
}

impl Default for InMemoryAuctionsRepo {
fn default() -> Self {
Self { store: Mutex::new(HashMap::new()) }
}
}
impl InMemoryAuctionsRepo {
pub fn new() -> Self {
let store = Mutex::new(HashMap::new());
Self { store }
Self { store: Mutex::new(HashMap::new()) }
}
}

impl AuctionsRepository for InMemoryAuctionsRepo {
fn get(&self, auction_id: AuctionId) -> Option<Auction> {
match self.store.lock().unwrap().get(&auction_id) {
None => None,
Some(auction) => Some(auction.clone()),
}
self.store.lock().unwrap().get(&auction_id).cloned()
}

fn save(&self, auction: &Auction) -> ApplicationResult<()> {
Expand Down

0 comments on commit 260b183

Please sign in to comment.