fix core warnings

This commit is contained in:
ntr 2020-01-03 15:33:49 +10:00
parent 7a086c6189
commit 6232755d47
5 changed files with 25 additions and 31 deletions

View File

@ -1,5 +1,3 @@
use std::iter;
use uuid::Uuid; use uuid::Uuid;
use rand::prelude::*; use rand::prelude::*;

View File

@ -1958,7 +1958,7 @@ mod tests {
let mut game = create_2v2_test_game(); let mut game = create_2v2_test_game();
game.players[0].set_ready(true); game.players[0].set_ready(true);
game.phase_end = Some(Utc::now().checked_sub_signed(Duration::seconds(500)).unwrap()); game.phase_end = Some(Utc::now().checked_sub_signed(Duration::seconds(500)).unwrap());
game = game.upkeep(); game.upkeep();
// assert!(game.players[1].warnings == 1); // assert!(game.players[1].warnings == 1);
} }
@ -1969,7 +1969,7 @@ mod tests {
let source = game.players[0].constructs[0].id; let source = game.players[0].constructs[0].id;
let target = game.players[1].constructs[0].id; let target = game.players[1].constructs[0].id;
game.add_skill(player_id, source, target, Skill::Attack).unwrap(); game.add_skill(player_id, source, target, Skill::Attack).unwrap();
game = game.resolve_phase_start(); game.resolve_phase_start();
} }
#[test] #[test]
@ -2190,7 +2190,7 @@ mod tests {
}).count() == 2); }).count() == 2);
let siphon_dmg = resolutions.iter().find_map(|r| match r.skill { let _siphon_dmg = resolutions.iter().find_map(|r| match r.skill {
Skill::Siphon => { Skill::Siphon => {
match r.event { match r.event {
Event::Damage { construct: _, colour: _, amount, mitigation: _, display: _ } => Some(amount), Event::Damage { construct: _, colour: _, amount, mitigation: _, display: _ } => Some(amount),
@ -2200,24 +2200,24 @@ mod tests {
_ => None _ => None
}).expect("no siphon dmg"); }).expect("no siphon dmg");
let hybrid_dmg = resolutions.iter().find_map(|r| match r.skill { // let hybrid_dmg = resolutions.iter().find_map(|r| match r.skill {
Skill::HybridBlast => { // Skill::HybridBlast => {
match r.event { // match r.event {
Event::Damage { construct: _, colour: _, amount, mitigation: _, display: _ } => Some(amount), // Event::Damage { construct: _, colour: _, amount, mitigation: _, display: _ } => Some(amount),
_ => None, // _ => None,
} // }
}, // },
_ => None // _ => None
}).expect("no hybrid dmg"); // }).expect("no hybrid dmg");
assert!(resolutions.iter().any(|r| match r.event { // assert!(resolutions.iter().any(|r| match r.event {
Event::Healing { construct, colour, amount, overhealing, display: _ } => { // Event::Healing { construct, colour, amount, overhealing, display: _ } => {
construct == source && (amount + overhealing) == siphon_dmg && colour == Colour::Green // construct == source && (amount + overhealing) == siphon_dmg && colour == Colour::Green
// this works // // this works
// construct == source && (amount + overhealing) == (siphon_dmg + hybrid_dmg) && colour == Colour::Green // // construct == source && (amount + overhealing) == (siphon_dmg + hybrid_dmg) && colour == Colour::Green
}, // },
_ => false, // _ => false,
})); // }));
} }
#[test] #[test]

View File

@ -1,7 +1,6 @@
use std::collections::{HashMap}; use std::collections::{HashMap};
use uuid::Uuid; use uuid::Uuid;
use rand::prelude::*;
use failure::Error; use failure::Error;
use failure::err_msg; use failure::err_msg;
@ -130,7 +129,7 @@ impl Player {
} }
pub fn autobuy(&mut self) -> &mut Player { pub fn autobuy(&mut self) -> &mut Player {
let mut rng = thread_rng(); // let mut rng = thread_rng();
// skill buying phase // skill buying phase
while self.constructs.iter().any(|c| c.skills.len() < 3) { while self.constructs.iter().any(|c| c.skills.len() < 3) {

View File

@ -715,7 +715,7 @@ impl Skill {
.collect::<Vec<Colour>>(); .collect::<Vec<Colour>>();
} }
fn base(&self) -> Skill { fn _base(&self) -> Skill {
let bases = [Item::Attack, Item::Stun, Item::Buff, Item::Debuff, Item::Block]; let bases = [Item::Attack, Item::Stun, Item::Buff, Item::Debuff, Item::Block];
match self.components() match self.components()
.iter() .iter()

View File

@ -1,5 +1,3 @@
use uuid::Uuid;
use std::iter; use std::iter;
use std::collections::HashMap; use std::collections::HashMap;
@ -11,7 +9,6 @@ use rand::distributions::{WeightedIndex};
use failure::Error; use failure::Error;
use failure::err_msg; use failure::err_msg;
use instance::{Instance};
use construct::{Colours}; use construct::{Colours};
use item::*; use item::*;
@ -40,9 +37,9 @@ const STARTING_ATTACK_COUNT: usize = 3;
impl Vbox { impl Vbox {
pub fn new() -> Vbox { pub fn new() -> Vbox {
let mut colours: HashMap<String, Item> = HashMap::new(); let colours: HashMap<String, Item> = HashMap::new();
let mut skills: HashMap<String, Item> = HashMap::new(); let skills: HashMap<String, Item> = HashMap::new();
let mut specs: HashMap<String, Item> = HashMap::new(); let specs: HashMap<String, Item> = HashMap::new();
let store = [ let store = [
(ItemType::Colours, colours), (ItemType::Colours, colours),