diff --git a/src/bin/main.rs b/src/bin/main.rs index 7e60b86..e0c7207 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -48,7 +48,7 @@ fn main() { setup_logger(); async_std::task::block_on(async move { //let mut entity_gateway = PostgresGateway::new("localhost", "elsewhere", "elsewhere", ""); - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); for i in 0..5 { let fake_user = NewUserAccountEntity { diff --git a/src/entity/gateway/inmemory.rs b/src/entity/gateway/inmemory.rs index 12f9f8f..d80dca7 100644 --- a/src/entity/gateway/inmemory.rs +++ b/src/entity/gateway/inmemory.rs @@ -21,8 +21,8 @@ pub struct InMemoryGateway { weapon_modifiers: Arc>>>, } -impl InMemoryGateway { - pub fn new() -> InMemoryGateway { +impl Default for InMemoryGateway { + fn default() -> InMemoryGateway { InMemoryGateway { users: Arc::new(Mutex::new(BTreeMap::new())), user_settings: Arc::new(Mutex::new(BTreeMap::new())), @@ -47,7 +47,7 @@ impl InMemoryGateway { ItemDetail::Weapon(mut weapon) => { if let Some(weapon_modifiers) = self.weapon_modifiers.lock().unwrap().get(&item.id) { for weapon_modifier in weapon_modifiers.iter() { - weapon.apply_modifier(&weapon_modifier); + weapon.apply_modifier(weapon_modifier); } } ItemDetail::Weapon(weapon) @@ -58,23 +58,21 @@ impl InMemoryGateway { for mag_modifier in mag_modifiers.iter() { match mag_modifier { mag::MagModifier::FeedMag {food} => { - items.get(&food).map(|mag_feed| { - match mag_feed.item { - ItemDetail::Tool(mag_feed) => mag.feed(mag_feed.tool), - _ => {} + if let Some(mag_feed) = items.get(food) { + if let ItemDetail::Tool(mag_feed) = mag_feed.item { + mag.feed(mag_feed.tool) } - }); + } }, mag::MagModifier::OwnerChange(class, section_id) => { mag.change_owner(*class, *section_id) }, mag::MagModifier::MagCell(mag_cell_id) => { - items.get(&mag_cell_id).map(|mag_cell| { - match mag_cell.item { - ItemDetail::Tool(mag_cell) => mag.apply_mag_cell(mag_cell.tool.try_into().unwrap()), - _ => {} + if let Some(mag_cell) = items.get(mag_cell_id) { + if let ItemDetail::Tool(mag_cell) = mag_cell.item { + mag.apply_mag_cell(mag_cell.tool.try_into().unwrap()) } - }); + } }, _ => {} } @@ -124,7 +122,7 @@ impl EntityGateway for InMemoryGateway { async fn get_user_by_id(&self, id: UserAccountId) -> Result { let users = self.users.lock().unwrap(); - users.get(&id).map(|k| k.clone()).ok_or(GatewayError::Error) + users.get(&id).cloned().ok_or(GatewayError::Error) } async fn get_user_by_name(&self, username: String) -> Result { @@ -233,17 +231,16 @@ impl EntityGateway for InMemoryGateway { } async fn change_item_location(&mut self, item_id: &ItemEntityId, item_location: ItemLocation) -> Result<(), GatewayError> { - self.items.lock().unwrap().get_mut(&item_id) - .map(|item_entity| { - item_entity.location = item_location - }); + if let Some(item_entity) = self.items.lock().unwrap().get_mut(item_id) { + item_entity.location = item_location + } Ok(()) } async fn feed_mag(&mut self, mag_item_id: &ItemEntityId, tool_item_id: &ItemEntityId) -> Result<(), GatewayError> { self.mag_modifiers.lock().unwrap() .entry(*mag_item_id) - .or_insert(Vec::new()) + .or_insert_with(Vec::new) .push(mag::MagModifier::FeedMag { food: *tool_item_id }); @@ -253,7 +250,7 @@ impl EntityGateway for InMemoryGateway { async fn change_mag_owner(&mut self, mag_item_id: &ItemEntityId, character: &CharacterEntity) -> Result<(), GatewayError> { self.mag_modifiers.lock().unwrap() .entry(*mag_item_id) - .or_insert(Vec::new()) + .or_insert_with(Vec::new) .push(mag::MagModifier::OwnerChange(character.char_class, character.section_id)); Ok(()) } @@ -261,15 +258,15 @@ impl EntityGateway for InMemoryGateway { async fn use_mag_cell(&mut self, mag_item_id: &ItemEntityId, mag_cell_id: &ItemEntityId) -> Result<(), GatewayError> { self.mag_modifiers.lock().unwrap() .entry(*mag_item_id) - .or_insert(Vec::new()) - .push(mag::MagModifier::MagCell(mag_cell_id.clone())); + .or_insert_with(Vec::new) + .push(mag::MagModifier::MagCell(*mag_cell_id)); Ok(()) } async fn add_weapon_modifier(&mut self, item_id: &ItemEntityId, modifier: weapon::WeaponModifier) -> Result<(), GatewayError> { self.weapon_modifiers.lock().unwrap() .entry(*item_id) - .or_insert(Vec::new()) + .or_insert_with(Vec::new) .push(modifier); Ok(()) } @@ -282,7 +279,7 @@ impl EntityGateway for InMemoryGateway { .find(|(id, _)| **id == *char_id) .map(|(_, inv)| inv.clone()) .map(|inv| self.apply_modifiers(inv)) - .unwrap_or(InventoryEntity::default())) + .unwrap_or_default()) } async fn get_character_bank(&mut self, char_id: &CharacterEntityId, _bank_name: BankName) -> Result { @@ -291,7 +288,7 @@ impl EntityGateway for InMemoryGateway { .iter() .find(|(id, _)| **id == *char_id) .map(|(_, b)| b.clone()) - .unwrap_or(BankEntity::default())) + .unwrap_or_default()) } async fn set_character_inventory(&mut self, char_id: &CharacterEntityId, inventory: &InventoryEntity) -> Result<(), GatewayError> { @@ -313,7 +310,7 @@ impl EntityGateway for InMemoryGateway { .iter() .find(|(id, _)| **id == *char_id) .map(|(_, inv)| inv.clone()) - .unwrap_or(EquippedEntity::default())) + .unwrap_or_default()) } async fn set_character_equips(&mut self, char_id: &CharacterEntityId, equipped: &EquippedEntity) -> Result<(), GatewayError> { diff --git a/src/entity/gateway/postgres/mod.rs b/src/entity/gateway/postgres/mod.rs index 7ba478c..a796653 100644 --- a/src/entity/gateway/postgres/mod.rs +++ b/src/entity/gateway/postgres/mod.rs @@ -1,3 +1,4 @@ +#[allow(clippy::module_inception)] pub mod postgres; pub mod migrations; pub mod models; diff --git a/src/entity/gateway/postgres/models.rs b/src/entity/gateway/postgres/models.rs index d6a0c14..f33f399 100644 --- a/src/entity/gateway/postgres/models.rs +++ b/src/entity/gateway/postgres/models.rs @@ -23,22 +23,22 @@ pub struct PgUserAccount { at_ship: bool, } -impl Into for PgUserAccount { - fn into(self) -> UserAccountEntity { +impl From for UserAccountEntity { + fn from(other: PgUserAccount) -> UserAccountEntity { UserAccountEntity { - id: UserAccountId(self.id as u32), - username: self.username, - password: self.password, - banned_until: self.banned, - muted_until: self.muted, - created_at: self.created_at, - flags: self.flags as u32, - guildcard: self.id as u32 + 1, + id: UserAccountId(other.id as u32), + username: other.username, + password: other.password, + banned_until: other.banned, + muted_until: other.muted, + created_at: other.created_at, + flags: other.flags as u32, + guildcard: other.id as u32 + 1, team_id: None, - activated: self.activated, - at_login: self.at_login, - at_character: self.at_character, - at_ship: self.at_ship, + activated: other.activated, + at_login: other.at_login, + at_character: other.at_character, + at_ship: other.at_ship, } } } @@ -56,19 +56,19 @@ pub struct PgUserSettings { team_name: Vec, //[u16; 0x10], } -impl Into for PgUserSettings { - fn into(self) -> UserSettingsEntity { +impl From for UserSettingsEntity { + fn from(other: PgUserSettings) -> UserSettingsEntity { UserSettingsEntity { - id: UserSettingsId(self.id as u32), - user_id: UserAccountId(self.user_account as u32), + id: UserSettingsId(other.id as u32), + user_id: UserAccountId(other.user_account as u32), settings: settings::UserSettings { - blocked_users: vec_to_array(self.blocked_users.chunks(4).map(|b| u32::from_le_bytes([b[0], b[1], b[2], b[3]])).collect()), - key_config: vec_to_array(self.key_config), - joystick_config: vec_to_array(self.joystick_config), - option_flags: self.option_flags as u32, - shortcuts: vec_to_array(self.shortcuts), - symbol_chats: vec_to_array(self.symbol_chats), - team_name: vec_to_array(self.team_name.chunks(2).map(|b| u16::from_le_bytes([b[0], b[1]])).collect()), + blocked_users: vec_to_array(other.blocked_users.chunks(4).map(|b| u32::from_le_bytes([b[0], b[1], b[2], b[3]])).collect()), + key_config: vec_to_array(other.key_config), + joystick_config: vec_to_array(other.joystick_config), + option_flags: other.option_flags as u32, + shortcuts: vec_to_array(other.shortcuts), + symbol_chats: vec_to_array(other.symbol_chats), + team_name: vec_to_array(other.team_name.chunks(2).map(|b| u16::from_le_bytes([b[0], b[1]])).collect()), } } } @@ -91,9 +91,9 @@ pub enum PgCharacterClass { FOnewearl, } -impl Into for PgCharacterClass { - fn into(self) -> CharacterClass { - match self { +impl From for CharacterClass { + fn from(other: PgCharacterClass) -> CharacterClass { + match other{ PgCharacterClass::HUmar => CharacterClass::HUmar, PgCharacterClass::HUnewearl => CharacterClass::HUnewearl, PgCharacterClass::HUcast => CharacterClass::HUcast, @@ -144,9 +144,9 @@ pub enum PgSectionId { Whitill, } -impl Into for PgSectionId { - fn into(self) -> SectionID { - match self { +impl From for SectionID { + fn from(other: PgSectionId) -> SectionID { + match other { PgSectionId::Viridia => SectionID::Viridia, PgSectionId::Greenill => SectionID::Greenill, PgSectionId::Skyly => SectionID::Skyly, @@ -220,55 +220,55 @@ pub struct PgCharacter { bank_meseta: i32, } -impl Into for PgCharacter { - fn into(self) -> CharacterEntity { +impl From for CharacterEntity { + fn from(other: PgCharacter) -> CharacterEntity { CharacterEntity { - id: CharacterEntityId(self.id as u32), - user_id: UserAccountId(self.user_account as u32), - slot: self.slot as u32, - name: self.name, - exp: self.exp as u32, - char_class: self.class.parse().unwrap(), - section_id: self.section_id.parse().unwrap(), + id: CharacterEntityId(other.id as u32), + user_id: UserAccountId(other.user_account as u32), + slot: other.slot as u32, + name: other.name, + exp: other.exp as u32, + char_class: other.class.parse().unwrap(), + section_id: other.section_id.parse().unwrap(), appearance: CharacterAppearance { - costume: self.costume as u16, - skin: self.skin as u16, - face: self.face as u16, - head: self.head as u16, - hair: self.hair as u16, - hair_r: self.hair_r as u16, - hair_g: self.hair_g as u16, - hair_b: self.hair_b as u16, - prop_x: self.prop_x, - prop_y: self.prop_y, + costume: other.costume as u16, + skin: other.skin as u16, + face: other.face as u16, + head: other.head as u16, + hair: other.hair as u16, + hair_r: other.hair_r as u16, + hair_g: other.hair_g as u16, + hair_b: other.hair_b as u16, + prop_x: other.prop_x, + prop_y: other.prop_y, }, techs: CharacterTechniques { - techs: self.techs.iter().enumerate().take(19).filter(|(_, t)| **t != 0xFF).map(|(i, t)| (tech::Technique::from_value(i as u8), TechLevel(*t)) ).collect() + techs: other.techs.iter().enumerate().take(19).filter(|(_, t)| **t != 0xFF).map(|(i, t)| (tech::Technique::from_value(i as u8), TechLevel(*t)) ).collect() }, config: CharacterConfig { - raw_data: vec_to_array(self.config) + raw_data: vec_to_array(other.config) }, info_board: CharacterInfoboard { - board: libpso::utf8_to_utf16_array!(self.infoboard, 172), + board: libpso::utf8_to_utf16_array!(other.infoboard, 172), }, guildcard: CharacterGuildCard { - description: self.guildcard, + description: other.guildcard, }, - option_flags: self.option_flags as u32, + option_flags: other.option_flags as u32, materials: CharacterMaterials { - power: self.power as u32, - mind: self.mind as u32, - def: self.def as u32, - evade: self.evade as u32, - luck: self.luck as u32, - hp: self.hp as u32, - tp: self.tp as u32, + power: other.power as u32, + mind: other.mind as u32, + def: other.def as u32, + evade: other.evade as u32, + luck: other.luck as u32, + hp: other.hp as u32, + tp: other.tp as u32, }, tech_menu: CharacterTechMenu { - tech_menu: vec_to_array(self.tech_menu) + tech_menu: vec_to_array(other.tech_menu) }, - meseta: self.meseta as u32, - bank_meseta: self.bank_meseta as u32, + meseta: other.meseta as u32, + bank_meseta: other.bank_meseta as u32, } } } @@ -300,10 +300,10 @@ impl From for PgWeapon { } } -impl Into for PgWeapon { - fn into(self) -> weapon::Weapon { +impl From for weapon::Weapon { + fn from(other: PgWeapon) -> weapon::Weapon { let mut attrs: [Option; 3] = [None; 3]; - for (attr, (atype, value)) in attrs.iter_mut().zip(self.attrs.iter()) { + for (attr, (atype, value)) in attrs.iter_mut().zip(other.attrs.iter()) { *attr = Some(weapon::WeaponAttribute { attr: *atype, value: *value @@ -311,11 +311,11 @@ impl Into for PgWeapon { } weapon::Weapon { - weapon: self.weapon, - special: self.special, - grind: self.grind, + weapon: other.weapon, + special: other.special, + grind: other.grind, attrs: attrs, - tekked: self.tekked, + tekked: other.tekked, } } } @@ -345,13 +345,13 @@ impl From for PgArmor { } } -impl Into for PgArmor { - fn into(self) -> armor::Armor { +impl From for armor::Armor { + fn from(other: PgArmor) -> armor::Armor { armor::Armor { - armor: self.armor, - dfp: self.dfp, - evp: self.evp, - slots: self.slots, + armor: other.armor, + dfp: other.dfp, + evp: other.evp, + slots: other.slots, } } } @@ -373,12 +373,12 @@ impl From for PgShield { } } -impl Into for PgShield { - fn into(self) -> shield::Shield { +impl From for shield::Shield { + fn from(other: PgShield) -> shield::Shield { shield::Shield { - shield: self.shield, - dfp: self.dfp, - evp: self.evp, + shield: other.shield, + dfp: other.dfp, + evp: other.evp, } } } @@ -398,11 +398,11 @@ impl From for PgUnit { } } -impl Into for PgUnit { - fn into(self) -> unit::Unit { +impl From for unit::Unit { + fn from(other: PgUnit) -> unit::Unit { unit::Unit { - unit: self.unit, - modifier: self.modifier, + unit: other.unit, + modifier: other.modifier, } } } @@ -420,10 +420,10 @@ impl From for PgTool { } } -impl Into for PgTool { - fn into(self) -> tool::Tool { +impl From for tool::Tool { + fn from(other: PgTool) -> tool::Tool { tool::Tool { - tool: self.tool, + tool: other.tool, } } } @@ -443,11 +443,11 @@ impl From for PgTechDisk { } } -impl Into for PgTechDisk { - fn into(self) -> tech::TechniqueDisk { +impl From for tech::TechniqueDisk { + fn from(other: PgTechDisk) -> tech::TechniqueDisk { tech::TechniqueDisk { - tech: self.tech, - level: self.level + tech: other.tech, + level: other.level } } } @@ -469,8 +469,8 @@ impl From for PgMag { } } -impl Into for PgMag { - fn into(self) -> mag::Mag { +impl From for mag::Mag { + fn from(other: PgMag) -> mag::Mag { /*mag::Mag { mag: self.mag, synchro: self.synchro, @@ -484,9 +484,9 @@ impl Into for PgMag { class: CharacterClass::HUmar, id: SectionID::Viridia, }*/ - let mut mag = mag::Mag::baby_mag(self.color as u16); - mag.mag = self.mag; - mag.synchro = self.synchro; + let mut mag = mag::Mag::baby_mag(other.color as u16); + mag.mag = other.mag; + mag.synchro = other.synchro; mag } } @@ -510,13 +510,13 @@ impl From for PgESWeapon { } } -impl Into for PgESWeapon { - fn into(self) -> esweapon::ESWeapon { +impl From for esweapon::ESWeapon { + fn from(other: PgESWeapon) -> esweapon::ESWeapon { esweapon::ESWeapon { - esweapon: self.esweapon, - special: self.special, - name: self.name, - grind: self.grind, + esweapon: other.esweapon, + special: other.special, + name: other.name, + grind: other.grind, } } } @@ -548,9 +548,9 @@ impl From for PgItemDetail { } } -impl Into for PgItemDetail { - fn into(self) -> ItemDetail { - match self { +impl From for ItemDetail { + fn from(other: PgItemDetail) -> ItemDetail { + match other { PgItemDetail::Weapon(weapon) => ItemDetail::Weapon(weapon.into()), PgItemDetail::Armor(armor) => ItemDetail::Armor(armor.into()), PgItemDetail::Shield(shield) => ItemDetail::Shield(shield.into()), @@ -613,9 +613,9 @@ impl From for PgItemLocationDetail { } } -impl Into for PgItemLocationDetail { - fn into(self) -> ItemLocation { - match self { +impl From for ItemLocation { + fn from(other: PgItemLocationDetail) -> ItemLocation { + match other{ PgItemLocationDetail::Inventory{character_id} => ItemLocation::Inventory{character_id: CharacterEntityId(character_id)}, PgItemLocationDetail::Bank{character_id, name} => ItemLocation::Bank{character_id: CharacterEntityId(character_id), name: BankName(name)}, PgItemLocationDetail::LocalFloor{character_id, map_area, x,y,z} => ItemLocation::LocalFloor{character_id: CharacterEntityId(character_id), map_area, x,y,z}, @@ -655,9 +655,9 @@ impl From for PgMagModifierDetail { } } -impl Into for PgMagModifierDetail { - fn into(self) -> mag::MagModifier { - match self { +impl From for mag::MagModifier { + fn from(other: PgMagModifierDetail) -> mag::MagModifier { + match other { PgMagModifierDetail::FeedMag(food) => mag::MagModifier::FeedMag{food: ItemEntityId(food as u32)}, PgMagModifierDetail::BankMag => mag::MagModifier::BankMag, PgMagModifierDetail::MagCell(cell) => mag::MagModifier::MagCell(ItemEntityId(cell as u32)), @@ -687,12 +687,12 @@ pub struct PgItemWithLocation { pub location: sqlx::types::Json, } -impl Into for PgItemWithLocation { - fn into(self) -> ItemEntity { +impl From for ItemEntity { + fn from(other: PgItemWithLocation) -> ItemEntity { ItemEntity { - id: ItemEntityId(self.id as u32), - item: self.item.0.into(), - location: self.location.0.into(), + id: ItemEntityId(other.id as u32), + item: other.item.0.into(), + location: other.location.0.into(), } } } @@ -740,18 +740,18 @@ pub struct PgEquipped { mag: Option, } -impl Into for PgEquipped { - fn into(self) -> EquippedEntity { +impl From for EquippedEntity{ + fn from(other: PgEquipped) -> EquippedEntity { EquippedEntity { - weapon: self.weapon.map(|i| ItemEntityId(i as u32)), - armor: self.armor.map(|i| ItemEntityId(i as u32)), - shield: self.shield.map(|i| ItemEntityId(i as u32)), - unit: [self.unit0.map(|i| ItemEntityId(i as u32)), - self.unit1.map(|i| ItemEntityId(i as u32)), - self.unit2.map(|i| ItemEntityId(i as u32)), - self.unit3.map(|i| ItemEntityId(i as u32)), + weapon: other.weapon.map(|i| ItemEntityId(i as u32)), + armor: other.armor.map(|i| ItemEntityId(i as u32)), + shield: other.shield.map(|i| ItemEntityId(i as u32)), + unit: [other.unit0.map(|i| ItemEntityId(i as u32)), + other.unit1.map(|i| ItemEntityId(i as u32)), + other.unit2.map(|i| ItemEntityId(i as u32)), + other.unit3.map(|i| ItemEntityId(i as u32)), ], - mag: self.mag.map(|i| ItemEntityId(i as u32)), + mag: other.mag.map(|i| ItemEntityId(i as u32)), } } } diff --git a/src/entity/gateway/postgres/postgres.rs b/src/entity/gateway/postgres/postgres.rs index 4d7a36e..1856fda 100644 --- a/src/entity/gateway/postgres/postgres.rs +++ b/src/entity/gateway/postgres/postgres.rs @@ -25,10 +25,10 @@ pub struct PostgresGateway { impl PostgresGateway { pub fn new(host: &str, dbname: &str, username: &str, password: &str) -> PostgresGateway { let mut conn = refinery::config::Config::new(refinery::config::ConfigDbType::Postgres) - .set_db_host(&host) - .set_db_user(&username) - .set_db_pass(&password) - .set_db_name(&dbname); + .set_db_host(host) + .set_db_user(username) + .set_db_pass(password) + .set_db_name(dbname); embedded::migrations::runner().run(&mut conn).unwrap(); let pool = async_std::task::block_on(async move { diff --git a/src/login/character.rs b/src/login/character.rs index a268d1c..9e05d26 100644 --- a/src/login/character.rs +++ b/src/login/character.rs @@ -858,7 +858,7 @@ mod test { #[async_std::test] async fn test_character_create() { - let test_data = InMemoryGateway::new(); + let test_data = InMemoryGateway::default(); let mut fake_user = ClientState::new(); fake_user.user = Some(UserAccountEntity { id: UserAccountId(3), diff --git a/tests/test_bank.rs b/tests/test_bank.rs index 486e9d0..2c1be0e 100644 --- a/tests/test_bank.rs +++ b/tests/test_bank.rs @@ -13,7 +13,7 @@ use common::*; #[async_std::test] async fn test_bank_items_sent_in_character_login() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await; @@ -52,7 +52,7 @@ async fn test_bank_items_sent_in_character_login() { #[async_std::test] async fn test_request_bank_items() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await; @@ -104,7 +104,7 @@ async fn test_request_bank_items() { #[async_std::test] async fn test_request_stacked_bank_items() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await; @@ -151,7 +151,7 @@ async fn test_request_stacked_bank_items() { #[async_std::test] async fn test_request_bank_items_sorted() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await; @@ -229,7 +229,7 @@ async fn test_request_bank_items_sorted() { #[async_std::test] async fn test_deposit_individual_item() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await; @@ -308,7 +308,7 @@ async fn test_deposit_individual_item() { #[async_std::test] async fn test_deposit_stacked_item() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await; @@ -372,7 +372,7 @@ async fn test_deposit_stacked_item() { #[async_std::test] async fn test_deposit_partial_stacked_item() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await; @@ -445,7 +445,7 @@ async fn test_deposit_partial_stacked_item() { #[async_std::test] async fn test_deposit_stacked_item_with_stack_already_in_bank() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await; @@ -524,7 +524,7 @@ async fn test_deposit_stacked_item_with_stack_already_in_bank() { #[async_std::test] async fn test_deposit_stacked_item_with_full_stack_in_bank() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; @@ -603,7 +603,7 @@ async fn test_deposit_stacked_item_with_full_stack_in_bank() { #[async_std::test] async fn test_deposit_individual_item_in_full_bank() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; @@ -684,7 +684,7 @@ async fn test_deposit_individual_item_in_full_bank() { #[async_std::test] async fn test_deposit_stacked_item_in_full_bank() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; @@ -764,7 +764,7 @@ async fn test_deposit_stacked_item_in_full_bank() { #[async_std::test] async fn test_deposit_stacked_item_in_full_bank_with_partial_stack() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; @@ -858,7 +858,7 @@ async fn test_deposit_stacked_item_in_full_bank_with_partial_stack() { #[async_std::test] async fn test_deposit_meseta() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await; char1.meseta = 300; @@ -895,7 +895,7 @@ async fn test_deposit_meseta() { #[async_std::test] async fn test_deposit_too_much_meseta() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await; char1.meseta = 300; @@ -934,7 +934,7 @@ async fn test_deposit_too_much_meseta() { #[async_std::test] async fn test_deposit_meseta_when_bank_is_maxed() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await; char1.meseta = 300; @@ -973,7 +973,7 @@ async fn test_deposit_meseta_when_bank_is_maxed() { #[async_std::test] async fn test_withdraw_individual_item() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await; @@ -1039,7 +1039,7 @@ async fn test_withdraw_individual_item() { #[async_std::test] async fn test_withdraw_stacked_item() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await; @@ -1103,7 +1103,7 @@ async fn test_withdraw_stacked_item() { #[async_std::test] async fn test_withdraw_partial_stacked_item() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await; @@ -1173,7 +1173,7 @@ async fn test_withdraw_partial_stacked_item() { #[async_std::test] async fn test_withdraw_stacked_item_with_stack_already_in_inventory() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await; @@ -1254,7 +1254,7 @@ async fn test_withdraw_stacked_item_with_stack_already_in_inventory() { #[async_std::test] async fn test_withdraw_stacked_item_with_full_stack_in_inventory() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; @@ -1333,7 +1333,7 @@ async fn test_withdraw_stacked_item_with_full_stack_in_inventory() { #[async_std::test] async fn test_withdraw_individual_item_in_full_inventory() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; @@ -1410,7 +1410,7 @@ async fn test_withdraw_individual_item_in_full_inventory() { #[async_std::test] async fn test_withdraw_stacked_item_in_full_inventory() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; @@ -1491,7 +1491,7 @@ async fn test_withdraw_stacked_item_in_full_inventory() { #[async_std::test] async fn test_withdraw_stacked_item_in_full_inventory_with_partial_stack() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; @@ -1587,7 +1587,7 @@ async fn test_withdraw_stacked_item_in_full_inventory_with_partial_stack() { #[async_std::test] async fn test_withdraw_meseta() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await; char1.bank_meseta = 300; @@ -1624,7 +1624,7 @@ async fn test_withdraw_meseta() { #[async_std::test] async fn test_withdraw_too_much_meseta() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await; char1.meseta = 999980; @@ -1662,7 +1662,7 @@ async fn test_withdraw_too_much_meseta() { #[async_std::test] async fn test_withdraw_meseta_inventory_is_maxed() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await; char1.meseta = 999999; diff --git a/tests/test_character.rs b/tests/test_character.rs index ba35270..f46fa67 100644 --- a/tests/test_character.rs +++ b/tests/test_character.rs @@ -10,7 +10,7 @@ use common::*; #[async_std::test] async fn test_save_options() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a").await; diff --git a/tests/test_exp_gain.rs b/tests/test_exp_gain.rs index fde9930..6d3e8b3 100644 --- a/tests/test_exp_gain.rs +++ b/tests/test_exp_gain.rs @@ -13,7 +13,7 @@ use common::*; #[async_std::test] async fn test_character_gains_exp() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a").await; @@ -50,7 +50,7 @@ async fn test_character_gains_exp() { #[async_std::test] async fn test_character_levels_up() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await; char1.exp = 49; @@ -90,7 +90,7 @@ async fn test_character_levels_up() { #[async_std::test] async fn test_character_levels_up_multiple_times() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a").await; @@ -134,7 +134,7 @@ async fn test_character_levels_up_multiple_times() { #[async_std::test] async fn test_one_character_gets_full_exp_and_other_attacker_gets_partial() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a").await; let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await; diff --git a/tests/test_item_actions.rs b/tests/test_item_actions.rs index 1cbaf6d..fa27041 100644 --- a/tests/test_item_actions.rs +++ b/tests/test_item_actions.rs @@ -12,7 +12,7 @@ use common::*; #[async_std::test] async fn test_equip_unit_from_equip_menu() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; @@ -98,7 +98,7 @@ async fn test_equip_unit_from_equip_menu() { #[async_std::test] async fn test_unequip_armor_with_units() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; @@ -175,7 +175,7 @@ async fn test_unequip_armor_with_units() { #[async_std::test] async fn test_sort_items() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; diff --git a/tests/test_item_pickup.rs b/tests/test_item_pickup.rs index bfac7b9..e54f0ec 100644 --- a/tests/test_item_pickup.rs +++ b/tests/test_item_pickup.rs @@ -12,7 +12,7 @@ use common::*; #[async_std::test] async fn test_pick_up_item_stack_of_items_already_in_inventory() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await; @@ -94,7 +94,7 @@ async fn test_pick_up_item_stack_of_items_already_in_inventory() { #[async_std::test] async fn test_pick_up_item_stack_of_items_not_already_held() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await; @@ -156,7 +156,7 @@ async fn test_pick_up_item_stack_of_items_not_already_held() { #[async_std::test] async fn test_pick_up_meseta_when_inventory_full() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; let (user2, mut char2) = new_user_character(&mut entity_gateway, "a2", "a").await; @@ -235,7 +235,7 @@ async fn test_pick_up_meseta_when_inventory_full() { #[async_std::test] async fn test_pick_up_partial_stacked_item_when_inventory_is_otherwise_full() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await; @@ -327,7 +327,7 @@ async fn test_pick_up_partial_stacked_item_when_inventory_is_otherwise_full() { #[async_std::test] async fn test_can_not_pick_up_item_when_inventory_full() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await; @@ -423,7 +423,7 @@ async fn test_can_not_pick_up_item_when_inventory_full() { #[async_std::test] async fn test_can_not_drop_more_meseta_than_is_held() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await; @@ -464,7 +464,7 @@ async fn test_can_not_drop_more_meseta_than_is_held() { #[async_std::test] async fn test_pick_up_stack_that_would_exceed_stack_limit() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await; @@ -544,7 +544,7 @@ async fn test_pick_up_stack_that_would_exceed_stack_limit() { #[async_std::test] async fn test_can_not_pick_up_meseta_when_full() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await; let (user2, mut char2) = new_user_character(&mut entity_gateway, "a2", "a").await; @@ -602,7 +602,7 @@ async fn test_can_not_pick_up_meseta_when_full() { #[async_std::test] async fn test_meseta_caps_at_999999_when_trying_to_pick_up_more() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await; let (user2, mut char2) = new_user_character(&mut entity_gateway, "a2", "a").await; @@ -659,7 +659,7 @@ async fn test_meseta_caps_at_999999_when_trying_to_pick_up_more() { #[async_std::test] async fn test_player_drops_partial_stack_and_other_player_picks_it_up() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await; diff --git a/tests/test_item_use.rs b/tests/test_item_use.rs index 03cb935..ba28e19 100644 --- a/tests/test_item_use.rs +++ b/tests/test_item_use.rs @@ -14,7 +14,7 @@ use common::*; #[async_std::test] async fn test_use_monomate() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; @@ -64,7 +64,7 @@ async fn test_use_monomate() { #[async_std::test] async fn test_use_monomate_twice() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; @@ -119,7 +119,7 @@ async fn test_use_monomate_twice() { #[async_std::test] async fn test_use_last_monomate() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; @@ -164,7 +164,7 @@ async fn test_use_last_monomate() { #[async_std::test] async fn test_use_nonstackable_tool() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; @@ -202,7 +202,7 @@ async fn test_use_nonstackable_tool() { #[async_std::test] async fn test_use_materials() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; @@ -282,4 +282,4 @@ pub async fn test_char_cannot_learn_wrong_tech() {} pub async fn test_char_cannot_learn_high_level_tech() {} #[async_std::test] -pub async fn test_android_cannot_learn_tech() {} \ No newline at end of file +pub async fn test_android_cannot_learn_tech() {} diff --git a/tests/test_mags.rs b/tests/test_mags.rs index 51675cf..268833d 100644 --- a/tests/test_mags.rs +++ b/tests/test_mags.rs @@ -13,7 +13,7 @@ use common::*; #[async_std::test] async fn test_mag_feed() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; @@ -92,7 +92,7 @@ async fn test_mag_feed() { #[async_std::test] async fn test_mag_change_owner() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await; let (_user2, mut char2) = new_user_character(&mut entity_gateway, "a2", "a").await; @@ -160,7 +160,7 @@ async fn test_mag_change_owner() { #[async_std::test] async fn test_mag_cell() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; diff --git a/tests/test_rooms.rs b/tests/test_rooms.rs index a641cbd..45f8ace 100644 --- a/tests/test_rooms.rs +++ b/tests/test_rooms.rs @@ -13,7 +13,7 @@ use common::*; #[async_std::test] async fn test_item_ids_reset_when_rejoining_rooms() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await; diff --git a/tests/test_shops.rs b/tests/test_shops.rs index 79aa438..ade8ccf 100644 --- a/tests/test_shops.rs +++ b/tests/test_shops.rs @@ -13,7 +13,7 @@ use common::*; #[async_std::test] async fn test_player_opens_weapon_shop() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await; char1.exp = 80000000; @@ -43,7 +43,7 @@ async fn test_player_opens_weapon_shop() { #[async_std::test] async fn test_player_opens_tool_shop() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await; char1.exp = 80000000; @@ -73,7 +73,7 @@ async fn test_player_opens_tool_shop() { #[async_std::test] async fn test_player_opens_armor_shop() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await; char1.exp = 80000000; @@ -103,7 +103,7 @@ async fn test_player_opens_armor_shop() { #[async_std::test] async fn test_player_buys_from_weapon_shop() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await; char1.exp = 80000000; @@ -142,7 +142,7 @@ async fn test_player_buys_from_weapon_shop() { #[async_std::test] async fn test_player_buys_from_tool_shop() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await; char1.exp = 80000000; @@ -180,7 +180,7 @@ async fn test_player_buys_from_tool_shop() { #[async_std::test] async fn test_player_buys_multiple_from_tool_shop() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await; char1.exp = 80000000; @@ -222,7 +222,7 @@ async fn test_player_buys_multiple_from_tool_shop() { #[async_std::test] async fn test_player_buys_from_armor_shop() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await; char1.exp = 80000000; @@ -264,7 +264,7 @@ async fn test_player_sells_to_shop() { #[async_std::test] async fn test_other_clients_see_purchase() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await; let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await; @@ -307,7 +307,7 @@ async fn test_other_clients_see_purchase() { #[async_std::test] async fn test_other_clients_see_stacked_purchase() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await; let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await; @@ -361,7 +361,7 @@ async fn test_other_clients_see_stacked_purchase() { #[async_std::test] async fn test_buying_item_without_enough_mseseta() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await; @@ -397,7 +397,7 @@ async fn test_buying_item_without_enough_mseseta() { #[async_std::test] async fn test_player_double_buys_from_tool_shop() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await; char1.exp = 80000000; @@ -463,7 +463,7 @@ async fn test_player_double_buys_from_tool_shop() { #[async_std::test] async fn test_techs_disappear_from_shop_when_bought() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await; char1.exp = 80000000; @@ -525,7 +525,7 @@ async fn test_techs_disappear_from_shop_when_bought() { // TOOD: this is not deterministic and can randomly fail #[async_std::test] async fn test_units_disappear_from_shop_when_bought() { - let mut entity_gateway = InMemoryGateway::new(); + let mut entity_gateway = InMemoryGateway::default(); let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await; char1.exp = 80000000;