style: format rust sources and fix clippy in ffi test
This commit is contained in:
@@ -35,7 +35,9 @@ pub extern "C" fn iron_arc_selftest(seed: u64) -> u64 {
|
|||||||
/// Returns the simulation version as a packed `major*10000 + minor*100 + patch`.
|
/// Returns the simulation version as a packed `major*10000 + minor*100 + patch`.
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn iron_arc_sim_version_code() -> u32 {
|
pub extern "C" fn iron_arc_sim_version_code() -> u32 {
|
||||||
let mut parts = sim::SIM_VERSION.split('.').filter_map(|p| p.parse::<u32>().ok());
|
let mut parts = sim::SIM_VERSION
|
||||||
|
.split('.')
|
||||||
|
.filter_map(|p| p.parse::<u32>().ok());
|
||||||
let major = parts.next().unwrap_or(0);
|
let major = parts.next().unwrap_or(0);
|
||||||
let minor = parts.next().unwrap_or(0);
|
let minor = parts.next().unwrap_or(0);
|
||||||
let patch = parts.next().unwrap_or(0);
|
let patch = parts.next().unwrap_or(0);
|
||||||
@@ -75,7 +77,7 @@ mod tests {
|
|||||||
assert_eq!(match_api::iron_arc_projectile(handle, xy.as_mut_ptr()), 1);
|
assert_eq!(match_api::iron_arc_projectile(handle, xy.as_mut_ptr()), 1);
|
||||||
let impacts = match_api::iron_arc_tick(handle, 400);
|
let impacts = match_api::iron_arc_tick(handle, 400);
|
||||||
assert!(impacts >= 1, "expected an impact, got {impacts}");
|
assert!(impacts >= 1, "expected an impact, got {impacts}");
|
||||||
assert!(match_api::iron_arc_terrain_ptr(handle).is_null() == false);
|
assert!(!match_api::iron_arc_terrain_ptr(handle).is_null());
|
||||||
match_api::iron_arc_free_match(handle);
|
match_api::iron_arc_free_match(handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user