Replace most panics in the core library with results
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@@ -160,6 +160,7 @@ impl ValueIdentifiable for ChoiceQueue {
|
||||
|
||||
#[cfg(test)]
|
||||
#[allow(clippy::unwrap_used)]
|
||||
#[allow(clippy::indexing_slicing)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::defines::LevelInt;
|
||||
|
||||
@@ -213,7 +213,7 @@ impl Battle {
|
||||
.library()
|
||||
.static_data()
|
||||
.types()
|
||||
.get_effectiveness(hit_type, &target.types());
|
||||
.get_effectiveness(hit_type, &target.types())?;
|
||||
script_hook!(
|
||||
change_effectiveness,
|
||||
executing_move,
|
||||
|
||||
@@ -147,6 +147,7 @@ impl ValueIdentifiable for Gen7BattleStatCalculator {
|
||||
}
|
||||
}
|
||||
#[cfg(test)]
|
||||
#[allow(clippy::indexing_slicing)]
|
||||
pub mod tests {
|
||||
use super::*;
|
||||
|
||||
|
||||
@@ -127,6 +127,7 @@ impl ValueIdentifiable for DynamicLibraryImpl {
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[allow(clippy::indexing_slicing)]
|
||||
pub mod test {
|
||||
use super::*;
|
||||
use crate::dynamic_data::libraries::battle_stat_calculator::Gen7BattleStatCalculator;
|
||||
|
||||
@@ -101,6 +101,7 @@ impl ValueIdentifiable for LearnedMove {
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[allow(clippy::unwrap_used)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::static_data::tests::MockMoveData;
|
||||
|
||||
@@ -421,7 +421,7 @@ impl Pokemon {
|
||||
}
|
||||
|
||||
let form = self.form();
|
||||
let ability = form.get_ability(self.ability_index);
|
||||
let ability = form.get_ability(self.ability_index)?;
|
||||
Ok(self
|
||||
.library
|
||||
.static_data()
|
||||
|
||||
@@ -53,7 +53,7 @@ impl PokemonBuilder {
|
||||
.species()
|
||||
.get(&self.species)
|
||||
.ok_or(PkmnError::InvalidSpeciesName { species: self.species })?;
|
||||
let form = species.get_default_form();
|
||||
let form = species.get_default_form()?;
|
||||
let p = Pokemon::new(
|
||||
self.library,
|
||||
species,
|
||||
|
||||
@@ -388,6 +388,8 @@ impl Clone for ScriptContainer {
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[allow(clippy::unwrap_used)]
|
||||
#[allow(clippy::indexing_slicing)]
|
||||
mod tests {
|
||||
use std::sync::atomic::{AtomicBool, AtomicPtr};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user