Cargo fmt

This commit is contained in:
Joseph Gerardot 2019-11-06 20:57:05 -05:00
parent 52020e4902
commit 0a44e714b4
No known key found for this signature in database
GPG Key ID: 2078DC064C1359E4
3 changed files with 6 additions and 17 deletions

View File

@ -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.

View File

@ -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!",
);
}

View File

@ -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()