mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Cargo fmt
This commit is contained in:
parent
52020e4902
commit
0a44e714b4
@ -60,7 +60,7 @@ impl Inventory {
|
||||
}
|
||||
|
||||
/// Add a series of items to an inventory without giving duplicates. (n * m complexity)
|
||||
///
|
||||
///
|
||||
/// Error if inventory cannot contain the items (is full), returning the un-added items.
|
||||
/// This is a lazy inefficient implementation, as it iterates over the inventory more times
|
||||
/// than necessary (n^2) and with the proper structure wouldn't need to iterate at all, but because
|
||||
@ -98,10 +98,7 @@ impl Inventory {
|
||||
|
||||
/// O(n) count the number of items in this inventory.
|
||||
pub fn count(&self) -> usize {
|
||||
self.slots
|
||||
.iter()
|
||||
.filter_map(|slot| slot.as_ref())
|
||||
.count()
|
||||
self.slots.iter().filter_map(|slot| slot.as_ref()).count()
|
||||
}
|
||||
|
||||
/// O(n) check if an item is in this inventory.
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
use super::*;
|
||||
use 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(),
|
||||
};
|
||||
inv.push_all_unique(TEST_ITEMS.iter().map(|a| a.clone()))
|
||||
.expect(
|
||||
"Pushing unique items into an inventory that already contains them didn't work!",
|
||||
);
|
||||
.expect("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.
|
||||
@ -67,6 +64,6 @@ fn push_all_unique_empty() {
|
||||
};
|
||||
inv.push_all_unique(TEST_ITEMS.iter().map(|a| a.clone()))
|
||||
.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;
|
||||
fn handle_debug(
|
||||
server: &mut Server,
|
||||
entity: EcsEntity,
|
||||
_args: String,
|
||||
_action: &ChatCommand,
|
||||
) {
|
||||
fn handle_debug(server: &mut Server, entity: EcsEntity, _args: String, _action: &ChatCommand) {
|
||||
if let Ok(items) = assets::load_glob::<Item>("common.items.debug.*") {
|
||||
server
|
||||
.state()
|
||||
|
Loading…
Reference in New Issue
Block a user