CI check for Clippy
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2023-01-06 14:25:29 +01:00
parent 1d66e08d48
commit ebc1565429
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
5 changed files with 21 additions and 7 deletions

View File

@ -11,4 +11,8 @@ steps:
- name: build-release-linux - name: build-release-linux
image: deukhoofd/linux64builder image: deukhoofd/linux64builder
commands: commands:
- cargo build --release - cargo build --release
- name: clippy-check
image: deukhoofd/linux64builder
commands:
- cargo clippy --all-targets -- -D warnings

View File

@ -78,7 +78,7 @@ mod tests {
random.expect_get_between().returning_st(|low, high| { random.expect_get_between().returning_st(|low, high| {
assert_eq!(1, low); assert_eq!(1, low);
assert_eq!(6, high); assert_eq!(6, high);
return 1; 1
}); });
Rc::new(random) Rc::new(random)
}); });
@ -89,7 +89,7 @@ mod tests {
.returning(|stat, amount, self_inflicted| { .returning(|stat, amount, self_inflicted| {
assert_eq!(Statistic::Attack, stat); assert_eq!(Statistic::Attack, stat);
assert_eq!(2, amount); assert_eq!(2, amount);
assert_eq!(false, self_inflicted); assert!(!self_inflicted);
true true
}); });

View File

@ -64,7 +64,7 @@ mod tests {
target target
.expect_battle() .expect_battle()
.once() .once()
.return_once_st(move || Some(battle.clone())); .return_once_st(move || Some(battle));
let target = Rc::new(target); let target = Rc::new(target);
let script = AfterYou::new(); let script = AfterYou::new();

View File

@ -52,7 +52,7 @@ impl Script for Assist {
let party = battle.find_party_for_pokemon(&user).unwrap().party(); let party = battle.find_party_for_pokemon(&user).unwrap().party();
let possible_moves = Self::get_party_moves(&party, &user); let possible_moves = Self::get_party_moves(&party, &user);
if possible_moves.len() == 0 { if possible_moves.is_empty() {
choice.fail(); choice.fail();
return; return;
} }

View File

@ -14,6 +14,9 @@
#![feature(adt_const_params)] #![feature(adt_const_params)]
#![cfg_attr(not(feature = "mock_data"), no_std)] #![cfg_attr(not(feature = "mock_data"), no_std)]
#![allow(incomplete_features)] #![allow(incomplete_features)]
// These give false positives too often
#![allow(clippy::borrowed_box)]
#![allow(clippy::needless_lifetimes)]
extern crate alloc; extern crate alloc;
extern crate core; extern crate core;
@ -24,6 +27,7 @@ static ALLOC: dlmalloc::GlobalDlmalloc = dlmalloc::GlobalDlmalloc {};
pub(crate) use crate::app_interface::StringKey; pub(crate) use crate::app_interface::StringKey;
pub(crate) use crate::handling::extern_ref::*; pub(crate) use crate::handling::extern_ref::*;
use alloc::boxed::Box;
#[macro_use] #[macro_use]
#[allow(dead_code)] #[allow(dead_code)]
@ -31,8 +35,12 @@ pub mod app_interface;
pub mod handling; pub mod handling;
pub mod utils; pub mod utils;
pub type LoadScriptFnType = Box<dyn Fn(ScriptCategory, &StringKey) -> Option<Box<dyn Script>>>;
#[cfg(not(feature = "mock_data"))] #[cfg(not(feature = "mock_data"))]
mod implementation { mod implementation {
use super::LoadScriptFnType;
use crate::app_interface::list::{EffectParameterImmutableList, ImmutableListWasm}; use crate::app_interface::list::{EffectParameterImmutableList, ImmutableListWasm};
use crate::app_interface::{ use crate::app_interface::{
BattleImpl, DamageSource, DynamicLibraryImpl, EffectParameter, ExecutingMoveImpl, ItemImpl, BattleImpl, DamageSource, DynamicLibraryImpl, EffectParameter, ExecutingMoveImpl, ItemImpl,
@ -48,8 +56,6 @@ mod implementation {
use cstr_core::{c_char, CString}; use cstr_core::{c_char, CString};
use hashbrown::HashMap; use hashbrown::HashMap;
pub type LoadScriptFnType = Box<dyn Fn(ScriptCategory, &StringKey) -> Option<Box<dyn Script>>>;
static mut LOAD_SCRIPT_FN: Option<LoadScriptFnType> = None; static mut LOAD_SCRIPT_FN: Option<LoadScriptFnType> = None;
pub fn set_load_script_fn(f: LoadScriptFnType) { pub fn set_load_script_fn(f: LoadScriptFnType) {
@ -663,5 +669,9 @@ mod implementation {
} }
} }
use crate::handling::{Script, ScriptCategory};
#[cfg(not(feature = "mock_data"))] #[cfg(not(feature = "mock_data"))]
pub use implementation::*; pub use implementation::*;
#[cfg(feature = "mock_data")]
pub fn set_load_script_fn(_f: LoadScriptFnType) {}