Fixes a bunch of clippy warnings, adds clippy to CI
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -75,11 +75,11 @@ impl<'own, 'library> Battle<'own, 'library> {
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
if !self.can_use(&choice) {
|
||||
if !self.can_use(choice) {
|
||||
return Ok(());
|
||||
}
|
||||
match choice {
|
||||
TurnChoice::Move(..) => self.execute_move_choice(&choice)?,
|
||||
TurnChoice::Move(..) => self.execute_move_choice(choice)?,
|
||||
TurnChoice::Item(_) => {}
|
||||
TurnChoice::Switch(_) => {}
|
||||
TurnChoice::Flee(_) => {}
|
||||
|
||||
@@ -7,6 +7,7 @@ use crate::dynamic_data::script_handling::script::Script;
|
||||
use crate::static_data::items::item::Item;
|
||||
use crate::static_data::libraries::static_data::StaticData;
|
||||
use crate::{PkmnResult, StringKey};
|
||||
use std::ops::Deref;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct DynamicLibrary {
|
||||
@@ -41,11 +42,11 @@ impl DynamicLibrary {
|
||||
pub fn stat_calculator(&self) -> &BattleStatCalculator {
|
||||
&self.stat_calculator
|
||||
}
|
||||
pub fn damage_calculator(&self) -> &Box<dyn DamageLibrary> {
|
||||
&self.damage_calculator
|
||||
pub fn damage_calculator(&self) -> &dyn DamageLibrary {
|
||||
self.damage_calculator.deref()
|
||||
}
|
||||
pub fn misc_library(&self) -> &Box<dyn MiscLibrary<'static>> {
|
||||
&self.misc_library
|
||||
pub fn misc_library(&self) -> &dyn MiscLibrary<'static> {
|
||||
self.misc_library.deref()
|
||||
}
|
||||
|
||||
pub fn load_script(&self, _category: ScriptCategory, _key: &StringKey) -> PkmnResult<Option<Box<dyn Script>>> {
|
||||
@@ -64,7 +65,7 @@ pub mod test {
|
||||
use crate::dynamic_data::libraries::misc_library::Gen7MiscLibrary;
|
||||
use crate::static_data::libraries::static_data;
|
||||
|
||||
pub fn build<'library>() -> DynamicLibrary {
|
||||
pub fn build() -> DynamicLibrary {
|
||||
DynamicLibrary {
|
||||
static_data: static_data::test::build(),
|
||||
stat_calculator: BattleStatCalculator {},
|
||||
|
||||
@@ -64,6 +64,12 @@ impl<'library> Gen7MiscLibrary<'library> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'library> Default for Gen7MiscLibrary<'library> {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'library> Drop for Gen7MiscLibrary<'library> {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
|
||||
@@ -121,8 +121,8 @@ impl<'own, 'library> Battle<'own, 'library> {
|
||||
pub fn event_hook(&self) -> &EventHook {
|
||||
&self.event_hook
|
||||
}
|
||||
pub fn history_holder(&self) -> &Box<HistoryHolder> {
|
||||
&self.history_holder
|
||||
pub fn history_holder(&self) -> &HistoryHolder {
|
||||
self.history_holder.deref()
|
||||
}
|
||||
pub fn current_turn(&self) -> u32 {
|
||||
self.current_turn.load(Ordering::Relaxed)
|
||||
|
||||
@@ -155,9 +155,9 @@ impl<'own, 'library> BattleSide<'own, 'library> {
|
||||
battle.event_hook().trigger(Event::Switch {
|
||||
side_index: self.index,
|
||||
index,
|
||||
pokemon: Some(&pokemon),
|
||||
pokemon: Some(pokemon),
|
||||
});
|
||||
script_hook!(on_switch_in, pokemon, &pokemon);
|
||||
script_hook!(on_switch_in, pokemon, pokemon);
|
||||
} else {
|
||||
self.battle().event_hook().trigger(Event::Switch {
|
||||
side_index: self.index,
|
||||
|
||||
@@ -35,7 +35,7 @@ impl ScriptSet {
|
||||
if let Some(script) = script {
|
||||
let name = script.name().clone();
|
||||
let arc = ScriptContainer::new(script);
|
||||
self.scripts.insert(name, arc.clone());
|
||||
self.scripts.insert(name, arc);
|
||||
Ok(Some(self.scripts.last().unwrap().1.clone()))
|
||||
} else {
|
||||
Ok(None)
|
||||
|
||||
Reference in New Issue
Block a user