Clippy fixes
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
f2b0d3b9f3
commit
aae41b93bb
|
@ -151,7 +151,7 @@ mod tests {
|
|||
|
||||
fn get_user(level: LevelInt) -> Pokemon {
|
||||
let lib = Arc::new(crate::dynamic_data::libraries::dynamic_library::test::build());
|
||||
let species = lib.static_data().species().get(&"foo".into()).unwrap().clone();
|
||||
let species = lib.static_data().species().get(&"foo".into()).unwrap();
|
||||
let form = species.get_form(&"default".into()).unwrap();
|
||||
|
||||
Pokemon::new(
|
||||
|
|
|
@ -117,7 +117,7 @@ impl Battle {
|
|||
number_of_hits,
|
||||
choice.user().clone(),
|
||||
used_move.clone(),
|
||||
move_data.clone(),
|
||||
move_data,
|
||||
move_choice.script().clone(),
|
||||
);
|
||||
let mut prevented = false;
|
||||
|
|
|
@ -141,8 +141,7 @@ impl Pokemon {
|
|||
.static_data()
|
||||
.natures()
|
||||
.get_nature(nature)
|
||||
.unwrap_or_else(|| panic!("Unknown nature name was given: {}.", &nature))
|
||||
.clone();
|
||||
.unwrap_or_else(|| panic!("Unknown nature name was given: {}.", &nature));
|
||||
let mut pokemon = Self {
|
||||
identifier: Default::default(),
|
||||
library,
|
||||
|
@ -892,7 +891,7 @@ pub mod test {
|
|||
#[test]
|
||||
fn construct_pokemon() {
|
||||
let lib = mock_library();
|
||||
let species = lib.static_data().species().get(&"foo".into()).unwrap().clone();
|
||||
let species = lib.static_data().species().get(&"foo".into()).unwrap();
|
||||
let form = species.get_form(&"default".into()).unwrap();
|
||||
|
||||
let pokemon = Pokemon::new(
|
||||
|
|
|
@ -46,7 +46,7 @@ impl PokemonBuilder {
|
|||
Random::default()
|
||||
};
|
||||
|
||||
let species = self.library.static_data().species().get(&self.species).unwrap().clone();
|
||||
let species = self.library.static_data().species().get(&self.species).unwrap();
|
||||
let form = species.get_default_form();
|
||||
let p = Pokemon::new(
|
||||
self.library,
|
||||
|
|
|
@ -36,7 +36,7 @@ impl ScriptSet {
|
|||
|
||||
/// Adds a script with a name to the set. If the script with that name already exists in this
|
||||
/// set, this makes that script stack instead. The return value here is that script.
|
||||
pub fn stack_or_add<'b, F>(&self, key: &StringKey, instantiation: &'b F) -> PkmnResult<Option<ScriptContainer>>
|
||||
pub fn stack_or_add<F>(&self, key: &StringKey, instantiation: &F) -> PkmnResult<Option<ScriptContainer>>
|
||||
where
|
||||
F: Fn() -> PkmnResult<Option<Arc<dyn Script>>>,
|
||||
{
|
||||
|
|
|
@ -261,7 +261,7 @@ extern "C" fn pokemon_is_ability_overriden(ptr: ExternPointer<Arc<Pokemon>>) ->
|
|||
/// Returns the currently active ability.
|
||||
#[no_mangle]
|
||||
extern "C" fn pokemon_active_ability(ptr: ExternPointer<Arc<Pokemon>>) -> IdentifiablePointer<Arc<dyn Ability>> {
|
||||
ptr.as_ref().active_ability().clone().into()
|
||||
ptr.as_ref().active_ability().into()
|
||||
}
|
||||
|
||||
/// Whether or not the Pokemon is allowed to gain experience.
|
||||
|
|
|
@ -35,7 +35,7 @@ unsafe extern "C" fn nature_library_get_nature(
|
|||
name: BorrowedPtr<c_char>,
|
||||
) -> IdentifiablePointer<Arc<dyn Nature>> {
|
||||
if let Some(nature) = ptr.as_ref().get_nature(&CStr::from_ptr(name).into()) {
|
||||
nature.clone().into()
|
||||
nature.into()
|
||||
} else {
|
||||
IdentifiablePointer::none()
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ impl Display for PokemonError {
|
|||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
PokemonError::ScriptNotFound { category, name } => {
|
||||
write!(f, "No script found with category `{}` and name `{}`", category, name)
|
||||
write!(f, "No script found with category `{category}` and name `{name}`")
|
||||
}
|
||||
PokemonError::InvalidTargetRequested => {
|
||||
write!(f, "Invalid target was requested")
|
||||
|
|
|
@ -58,7 +58,7 @@ impl<T: ValueIdentifiable + ?Sized> ExternRef<T> {
|
|||
|
||||
/// Returns the real value for a given ExternRef. Note that the requested type must be the same as the type of the
|
||||
/// value when it was passed before. If these types do not match, this will panic.
|
||||
pub fn value_func<'a, 'b>(&'a self, env: &'b FunctionEnvMut<WebAssemblyEnv>) -> Option<&'b T>
|
||||
pub fn value_func<'a>(&self, env: &'a FunctionEnvMut<WebAssemblyEnv>) -> Option<&'a T>
|
||||
where
|
||||
T: Sized + 'static,
|
||||
{
|
||||
|
@ -85,7 +85,7 @@ impl<T: ValueIdentifiable + ?Sized> ExternRef<T> {
|
|||
|
||||
/// Returns the real value for a given ExternRef. Note that the requested type must be the same as the type of the
|
||||
/// value when it was passed before. If these types do not match, this will panic.
|
||||
pub fn value<'a, 'b, 'c>(&'a self, env: &'b Arc<WebAssemblyEnvironmentData>) -> Option<&'c T>
|
||||
pub fn value<'a>(&self, env: &Arc<WebAssemblyEnvironmentData>) -> Option<&'a T>
|
||||
where
|
||||
T: Sized + 'static,
|
||||
{
|
||||
|
|
|
@ -382,7 +382,7 @@ impl WebAssemblyEnvironmentData {
|
|||
pub fn get_extern_vec_ref_extern_ref(&self, extern_vec_ref: usize, index: usize) -> usize {
|
||||
let r = self.extern_vec_ref_lookup.read();
|
||||
let v = r.get(&extern_vec_ref).unwrap();
|
||||
v[index as usize]
|
||||
v[index]
|
||||
}
|
||||
|
||||
/// Gets the extern ref index belonging to a specific pointer. If none exists, this will create
|
||||
|
@ -393,7 +393,7 @@ impl WebAssemblyEnvironmentData {
|
|||
ptr: value as *const dyn Any,
|
||||
is_vec,
|
||||
}) {
|
||||
return *v as usize;
|
||||
return *v;
|
||||
}
|
||||
let index = {
|
||||
let mut extern_ref_guard = self.extern_ref_pointers.write();
|
||||
|
@ -416,7 +416,7 @@ impl WebAssemblyEnvironmentData {
|
|||
|
||||
/// Gets a value from the extern ref lookup. This turns an earlier registered index back into
|
||||
/// its proper value, validates its type, and returns the value.
|
||||
pub fn get_extern_ref_value<'a, 'b, T: ?Sized>(&'a self, index: usize) -> &'b dyn Any {
|
||||
pub fn get_extern_ref_value<'a, T: ?Sized>(&self, index: usize) -> &'a dyn Any {
|
||||
let read_guard = self.extern_ref_pointers.read();
|
||||
let ptr = read_guard.get(index - 1).unwrap();
|
||||
if self
|
||||
|
|
|
@ -92,10 +92,10 @@ impl From<StringKey> for EffectParameter {
|
|||
impl Display for EffectParameter {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
EffectParameter::Bool(_, v) => f.write_fmt(format_args!("EffectParameter::Bool({})", v)),
|
||||
EffectParameter::Int(_, v) => f.write_fmt(format_args!("EffectParameter::Int({})", v)),
|
||||
EffectParameter::Float(_, v) => f.write_fmt(format_args!("EffectParameter::Float({})", v)),
|
||||
EffectParameter::String(_, v) => f.write_fmt(format_args!("EffectParameter::String({})", v)),
|
||||
EffectParameter::Bool(_, v) => f.write_fmt(format_args!("EffectParameter::Bool({v})")),
|
||||
EffectParameter::Int(_, v) => f.write_fmt(format_args!("EffectParameter::Int({v})")),
|
||||
EffectParameter::Float(_, v) => f.write_fmt(format_args!("EffectParameter::Float({v})")),
|
||||
EffectParameter::String(_, v) => f.write_fmt(format_args!("EffectParameter::String({v})")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue