Cleanup, fmt, appease clippy

This commit is contained in:
Imbris 2023-04-18 23:51:33 -04:00
parent c6f5e8dac2
commit c82e6cfc77
3 changed files with 6 additions and 12 deletions

View File

@ -112,7 +112,7 @@ impl<S: Clone + Eq + Hash, H: BuildHasher + Clone> Astar<S, H> {
}) })
.collect(), .collect(),
visited_nodes: { visited_nodes: {
let mut s = HashMap::with_capacity_and_hasher(1, hasher.clone()); let mut s = HashMap::with_capacity_and_hasher(1, hasher);
s.extend(core::iter::once((start.clone(), NodeEntry { s.extend(core::iter::once((start.clone(), NodeEntry {
came_from: start, came_from: start,
cheapest_score: 0.0, cheapest_score: 0.0,

View File

@ -83,6 +83,7 @@ use common::{
terrain::{TerrainChunk, TerrainChunkSize}, terrain::{TerrainChunk, TerrainChunkSize},
vol::RectRasterableVol, vol::RectRasterableVol,
}; };
use common_base::prof_span;
use common_ecs::run_now; use common_ecs::run_now;
use common_net::{ use common_net::{
msg::{ClientType, DisconnectReason, ServerGeneral, ServerInfo, ServerMsg}, msg::{ClientType, DisconnectReason, ServerGeneral, ServerInfo, ServerMsg},
@ -90,7 +91,6 @@ use common_net::{
}; };
use common_state::{BlockDiff, BuildAreas, State}; use common_state::{BlockDiff, BuildAreas, State};
use common_systems::add_local_systems; use common_systems::add_local_systems;
use common_base::prof_span;
use metrics::{EcsSystemMetrics, PhysicsMetrics, TickMetrics}; use metrics::{EcsSystemMetrics, PhysicsMetrics, TickMetrics};
use network::{ListenAddr, Network, Pid}; use network::{ListenAddr, Network, Pid};
use persistence::{ use persistence::{
@ -455,9 +455,7 @@ impl Server {
// Insert the world into the ECS (todo: Maybe not an Arc?) // Insert the world into the ECS (todo: Maybe not an Arc?)
let world = Arc::new(world); let world = Arc::new(world);
state.ecs_mut().insert(Arc::clone(&world)); state.ecs_mut().insert(Arc::clone(&world));
state state.ecs_mut().insert(lod);
.ecs_mut()
.insert(lod);
state.ecs_mut().insert(index.clone()); state.ecs_mut().insert(index.clone());
// Set starting time for the server. // Set starting time for the server.

View File

@ -1169,12 +1169,9 @@ impl Civs {
// Find a route using existing paths // Find a route using existing paths
// //
// If the novel path isn't efficient compared to this, don't use it // If the novel path isn't efficient compared to this, don't use it
let max_novel_cost = {
let max_novel_cost = self let max_novel_cost = self
.route_between(site, nearby) .route_between(site, nearby)
.map_or(f32::MAX, |(_, route_cost)| route_cost / 3.0); .map_or(f32::MAX, |(_, route_cost)| route_cost / 3.0);
max_novel_cost
};
let start = loc; let start = loc;
let end = self.sites.get(nearby).center; let end = self.sites.get(nearby).center;
@ -1215,7 +1212,6 @@ impl Civs {
ctx.sim.get_mut(locs[1]).unwrap().path.0.neighbors |= 1 << (i as u8); ctx.sim.get_mut(locs[1]).unwrap().path.0.neighbors |= 1 << (i as u8);
randomize_offset = true; randomize_offset = true;
} else if !self.bridges.contains_key(&locs[1]) { } else if !self.bridges.contains_key(&locs[1]) {
//dbg!("here"); called 18 times
let center = (locs[1] + locs[2]) / 2; let center = (locs[1] + locs[2]) / 2;
let id = let id =
establish_site(self, &mut ctx.reseed(), center, move |place| { establish_site(self, &mut ctx.reseed(), center, move |place| {