diff --git a/src/pathfinding.rs b/src/pathfinding.rs index dc86593..cb9d119 100644 --- a/src/pathfinding.rs +++ b/src/pathfinding.rs @@ -65,7 +65,7 @@ impl .0 .iter() .filter(|(a, _, _, _)| query.1.get(*a).is_ok()) - .map(|(a, b, c, d)| (a, b.clone(), c.clone(), d.clone())) + .map(|(a, b, c, d)| (a, *b, c.clone(), *d)) .collect::>(); let mut m = HashMap::new(); for (e, a, b, c) in entries { @@ -168,7 +168,7 @@ fn find_path_for_shape( successors }, |p| (p.distance_squared(&destination) * 100.) as u32, - |p| *p == destination.into(), + |p| *p == destination, ); channel_clone .send(if let Some(path) = path { @@ -211,9 +211,9 @@ fn calculate_path( } } for (entity, destination, coordinates, shape) in query.iter() { - if !calculating.contains_key(&entity) { + if let std::collections::hash_map::Entry::Vacant(e) = calculating.entry(entity) { let (tx, rx) = unbounded(); - calculating.insert(entity, rx); + e.insert(rx); for map in map.iter() { find_path_for_shape( &*pool, diff --git a/src/visibility.rs b/src/visibility.rs index 7cc878d..ae933fb 100644 --- a/src/visibility.rs +++ b/src/visibility.rs @@ -141,7 +141,7 @@ fn update_viewshed( ); } -fn update_viewshed_for_coordinates<'a>( +fn update_viewshed_for_coordinates( visible: Query<(&Coordinates, &BlocksVisibility), Changed>, mut viewers: Query<(Entity, &mut Viewshed, &Coordinates)>, map: Query<&Map>, @@ -169,7 +169,7 @@ fn update_viewshed_for_coordinates<'a>( } } -fn update_viewshed_for_start<'a>( +fn update_viewshed_for_start( mut viewers: Query<(Entity, &mut Viewshed, &Coordinates), Changed>, map: Query<&Map>, query_pipeline: Res, @@ -191,7 +191,7 @@ fn update_viewshed_for_start<'a>( } } -fn remove_blocks_visibility<'a>( +fn remove_blocks_visibility( removed: RemovedComponents, mut viewers: Query<(Entity, &mut Viewshed, &Coordinates)>, map: Query<&Map>,