1
Fork 0
mirror of https://github.com/Steffo99/patched-porobot.git synced 2024-12-22 17:44:22 +00:00

Replace filter for Some followed by unwrap with flatten

This commit is contained in:
Steffo 2023-07-03 03:07:42 +02:00
parent f549bf5fef
commit 618ebb4d50
Signed by: steffo
GPG key ID: 2A24051445686895

View file

@ -521,8 +521,7 @@ impl Deck {
pub fn cards_are_allowed_in(&self, cards: &CardIndex, format: CardFormat) -> bool {
self.contents.keys()
.map(|cc| cc.to_card(&cards))
.filter(|o| o.is_some())
.map(|o| o.unwrap())
.flatten()
.all(|c| c.formats.contains(&format))
}