clippy fixes

This commit is contained in:
Isse 2023-11-05 17:49:27 +01:00
parent 7fd255ec6c
commit e0dbba0279
4 changed files with 8 additions and 9 deletions

View File

@ -194,7 +194,7 @@ impl CharacterBehavior for Data {
rng.gen_range(-1.0..=1.0),
0.0,
))
.map(|dir| comp::Ori::from(dir))
.map(comp::Ori::from)
.unwrap_or_default(),
npc: NpcBuilder::new(stats, body, comp::Alignment::Owned(*data.uid))
.with_skill_set(skill_set)

View File

@ -307,11 +307,10 @@ impl NpcLinks {
if let Some(riders) = self.mount_map.get_mut(link.mount) {
if link.is_steering && riders.steerer == Some(id) {
riders.steerer = None;
} else {
if let Some((i, _)) = riders.riders.iter().enumerate().find(|(_, i)| **i == id) {
riders.riders.remove(i);
}
} else if let Some((i, _)) = riders.riders.iter().enumerate().find(|(_, i)| **i == id) {
riders.riders.remove(i);
}
if riders.steerer.is_none() && riders.riders.is_empty() {
self.mount_map.remove(link.mount);
}
@ -457,8 +456,8 @@ impl From<HopSlotMap<MountId, NpcLink>> for NpcLinks {
}
}
impl Into<HopSlotMap<MountId, NpcLink>> for NpcLinks {
fn into(self) -> HopSlotMap<MountId, NpcLink> { self.links }
impl From<NpcLinks> for HopSlotMap<MountId, NpcLink> {
fn from(other: NpcLinks) -> Self { other.links }
}
slotmap::new_key_type! {
pub struct MountId;

View File

@ -790,7 +790,7 @@ impl StateExt for State {
rng.gen_range(-1.0..=1.0),
0.0,
))
.map(|dir| comp::Ori::from(dir))
.map(comp::Ori::from)
.unwrap_or_default();
let pet_entity = self
.create_npc(

View File

@ -218,7 +218,7 @@ impl<'a> System<'a> for Sys {
rng.gen_range(-1.0..=1.0),
0.0,
))
.map(|dir| comp::Ori::from(dir))
.map(comp::Ori::from)
.unwrap_or_default(),
npc: NpcBuilder::new(stats, body, alignment)
.with_skill_set(skill_set)