Fixes all clippy warnings
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-07-01 18:20:16 +02:00
parent 717fcdefda
commit 0d95dcf618
19 changed files with 108 additions and 55 deletions

View File

@@ -43,6 +43,6 @@ pub trait DataLibrary<'a, T: 'a> {
/// Gets a random value from the library.
fn random_value(&self, rand: &mut Random) -> &T {
let i = rand.get_between(0, self.len() as i32);
return &self.map().get_index(i as usize).unwrap().1;
return self.map().get_index(i as usize).unwrap().1;
}
}

View File

@@ -17,12 +17,21 @@ pub use static_data::StaticData;
#[doc(inline)]
pub use type_library::*;
/// The library data for abilities.
mod ability_library;
/// Basic helper trait for libraries.
mod data_library;
/// The library data for groth rates.
mod growth_rate_library;
/// The library data for items.
mod item_library;
/// The library data for misc settings.
mod library_settings;
/// The library data for moves.
mod move_library;
/// The library data for species.
mod species_library;
/// The combination of all libraries.
pub(crate) mod static_data;
/// The library data for types.
mod type_library;

View File

@@ -15,11 +15,19 @@ pub use statistic_set::*;
#[doc(inline)]
pub use statistics::*;
/// Growth rates define how fast a Pokemon can level up.
mod growth_rates;
/// Items are objects which the player can pick up, keep in their Bag, and use in some manner
mod items;
/// The libraries module holds all data storage types.
pub(crate) mod libraries;
/// Moves are actions Pokemon can take in battle.
mod moves;
/// Natures give stat boosts to specific stats.
mod natures;
/// Species data holds base data for species.
mod species_data;
/// Statistic sets are collection of different statistics that can be used by Pokemon in multiple ways.
mod statistic_set;
/// Statistics are numerical values on Pokemon that are used in battle.
mod statistics;

View File

@@ -3,5 +3,7 @@ pub use move_data::*;
#[doc(inline)]
pub use secondary_effect::*;
/// The data belonging to a certain move.
mod move_data;
/// A secondary effect is an effect on a move that happens after it hits.
mod secondary_effect;

View File

@@ -35,3 +35,13 @@ impl Ability {
&self.parameters
}
}
/// An ability index allows us to find an ability on a form. It combines a bool for whether the
/// ability is hidden or not, and then an index of the ability.
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub struct AbilityIndex {
/// Whether or not the ability we're referring to is a hidden ability.
pub hidden: bool,
/// The index of the ability.
pub index: u8,
}

View File

@@ -1,9 +0,0 @@
/// An ability index allows us to find an ability on a form. It combines a bool for whether the
/// ability is hidden or not, and then an index of the ability.
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub struct AbilityIndex {
/// Whether or not the ability we're referring to is a hidden ability.
pub hidden: bool,
/// The index of the ability.
pub index: u8,
}

View File

@@ -1,9 +1,9 @@
use hashbrown::HashSet;
use crate::static_data::LearnableMoves;
use crate::static_data::Statistic;
use crate::static_data::TypeIdentifier;
use crate::static_data::{Ability, StaticStatisticSet};
use crate::static_data::{AbilityIndex, TypeIdentifier};
use crate::static_data::{AbilityIndex, LearnableMoves};
use crate::Random;
use crate::StringKey;

View File

@@ -1,19 +1,22 @@
#[doc(inline)]
pub use ability::Ability;
pub use ability::*;
#[doc(inline)]
pub use ability_index::AbilityIndex;
pub use form::*;
#[doc(inline)]
pub use form::Form;
pub use gender::*;
#[doc(inline)]
pub use gender::Gender;
pub use learnable_moves::*;
#[doc(inline)]
pub use learnable_moves::LearnableMoves;
#[doc(inline)]
pub use species::Species;
pub use species::*;
/// An ability is a passive effect in battle that is attached to a Pokemon.
mod ability;
mod ability_index;
/// A form is a variant of a specific species. A species always has at least one form, but can have
/// many more.
mod form;
/// Gender is a Pokemon characteristic.
mod gender;
/// This allows for storage of the moves a Pokemon can learn.
mod learnable_moves;
/// The data belonging to a Pokemon with certain characteristics.
mod species;