mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Cargo fmt
This commit is contained in:
@ -98,10 +98,7 @@ impl Inventory {
|
|||||||
|
|
||||||
/// O(n) count the number of items in this inventory.
|
/// O(n) count the number of items in this inventory.
|
||||||
pub fn count(&self) -> usize {
|
pub fn count(&self) -> usize {
|
||||||
self.slots
|
self.slots.iter().filter_map(|slot| slot.as_ref()).count()
|
||||||
.iter()
|
|
||||||
.filter_map(|slot| slot.as_ref())
|
|
||||||
.count()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// O(n) check if an item is in this inventory.
|
/// O(n) check if an item is in this inventory.
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
@ -44,9 +43,7 @@ fn push_unique_all_full() {
|
|||||||
slots: TEST_ITEMS.iter().map(|a| Some(a.clone())).collect(),
|
slots: TEST_ITEMS.iter().map(|a| Some(a.clone())).collect(),
|
||||||
};
|
};
|
||||||
inv.push_all_unique(TEST_ITEMS.iter().map(|a| a.clone()))
|
inv.push_all_unique(TEST_ITEMS.iter().map(|a| a.clone()))
|
||||||
.expect(
|
.expect("Pushing unique items into an inventory that already contains them didn't work!");
|
||||||
"Pushing unique items into an inventory that already contains them didn't work!",
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Attempting to push uniquely into an inventory containing all the items should work fine.
|
/// Attempting to push uniquely into an inventory containing all the items should work fine.
|
||||||
@ -67,6 +64,6 @@ fn push_all_unique_empty() {
|
|||||||
};
|
};
|
||||||
inv.push_all_unique(TEST_ITEMS.iter().map(|a| a.clone()))
|
inv.push_all_unique(TEST_ITEMS.iter().map(|a| a.clone()))
|
||||||
.expect(
|
.expect(
|
||||||
"Pushing unique items into an empty inventory that didn't contain them didn't work!",
|
"Pushing unique items into an empty inventory that didn't contain them didn't work!",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -997,12 +997,7 @@ fn handle_exp(server: &mut Server, entity: EcsEntity, args: String, action: &Cha
|
|||||||
}
|
}
|
||||||
|
|
||||||
use common::comp::Item;
|
use common::comp::Item;
|
||||||
fn handle_debug(
|
fn handle_debug(server: &mut Server, entity: EcsEntity, _args: String, _action: &ChatCommand) {
|
||||||
server: &mut Server,
|
|
||||||
entity: EcsEntity,
|
|
||||||
_args: String,
|
|
||||||
_action: &ChatCommand,
|
|
||||||
) {
|
|
||||||
if let Ok(items) = assets::load_glob::<Item>("common.items.debug.*") {
|
if let Ok(items) = assets::load_glob::<Item>("common.items.debug.*") {
|
||||||
server
|
server
|
||||||
.state()
|
.state()
|
||||||
|
Reference in New Issue
Block a user