Browse Source

drain_filter -> extract_if

andy/update-rust
andy 1 year ago
parent
commit
bca78c0611
  1. 1
      src/lib.rs
  2. 4
      src/ship/items/floor.rs

1
src/lib.rs

@ -1,6 +1,7 @@
#![allow(clippy::type_complexity)]
#![allow(incomplete_features)]
#![feature(inline_const)]
#![feature(extract_if)]
#![feature(try_blocks)]
#![feature(test)]
#![feature(error_generic_member_access)]

4
src/ship/items/floor.rs

@ -96,13 +96,13 @@ pub struct FloorState {
impl FloorState {
pub fn take_item(&mut self, item_id: &ClientItemId) -> Option<FloorItem> {
let item = self.local.0
.drain_filter(|item| {
.extract_if(|item| {
item.item_id == *item_id
})
.next();
item.or_else(|| {
self.shared.0
.drain_filter(|item| {
.extract_if(|item| {
item.item_id == *item_id
})
.next()

Loading…
Cancel
Save