From ef40ebe0c85497a2dfdb1842ea0dda5f2f11ce07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=A4rtens?= Date: Wed, 24 Nov 2021 10:09:22 +0100 Subject: [PATCH 1/2] update toolchain to `nightly-2021-11-24` --- client/src/bin/bot/tui.rs | 2 +- common/frontend/src/lib.rs | 2 +- common/src/combat.rs | 2 +- common/src/comp/inventory/item/mod.rs | 2 +- common/src/comp/inventory/loadout_builder.rs | 9 ++-- common/src/comp/inventory/mod.rs | 2 +- common/src/lib.rs | 3 +- common/src/recipe.rs | 2 +- common/src/terrain/sprite.rs | 4 +- common/src/util/mod.rs | 8 ++-- common/systems/src/character_behavior.rs | 16 +++---- common/systems/src/phys.rs | 8 ++-- rust-toolchain | 2 +- server/src/cmd.rs | 8 ++-- server/src/events/trade.rs | 2 +- server/src/lib.rs | 2 +- .../src/persistence/character/conversions.rs | 5 +-- server/src/sys/agent.rs | 4 +- server/src/sys/msg/register.rs | 4 +- server/src/sys/terrain.rs | 2 + voxygen/src/hud/bag.rs | 2 +- voxygen/src/hud/chat.rs | 2 +- voxygen/src/hud/mod.rs | 17 ++++---- voxygen/src/hud/overhead.rs | 6 +-- voxygen/src/hud/skillbar.rs | 2 +- voxygen/src/hud/social.rs | 2 +- voxygen/src/hud/trade.rs | 20 ++++----- voxygen/src/main.rs | 4 +- voxygen/src/menu/char_selection/ui/mod.rs | 26 ++++++++---- voxygen/src/mesh/terrain.rs | 1 + voxygen/src/render/renderer/drawer.rs | 2 +- .../src/render/renderer/pipeline_creation.rs | 4 +- voxygen/src/session/mod.rs | 16 +++---- voxygen/src/ui/widgets/slot.rs | 2 +- world/src/layer/tree.rs | 1 + world/src/lib.rs | 7 +++- world/src/sim/erosion.rs | 42 +++++++++++++++---- world/src/sim/mod.rs | 2 +- world/src/sim2/mod.rs | 4 +- world/src/site2/tile.rs | 8 ++-- 40 files changed, 149 insertions(+), 110 deletions(-) diff --git a/client/src/bin/bot/tui.rs b/client/src/bin/bot/tui.rs index af3014da96..055a0b3287 100644 --- a/client/src/bin/bot/tui.rs +++ b/client/src/bin/bot/tui.rs @@ -93,7 +93,7 @@ impl Tui { if [HelpDisplayed, MissingRequiredArgument, UnknownArgument].contains(&e.kind) => { println!("{}", e.message); - } + }, Err(e) => { error!("{:?}", e); return false; diff --git a/common/frontend/src/lib.rs b/common/frontend/src/lib.rs index 7ebfa4585d..411e5ad787 100644 --- a/common/frontend/src/lib.rs +++ b/common/frontend/src/lib.rs @@ -84,7 +84,7 @@ where let filter = match std::env::var_os(RUST_LOG_ENV).map(|s| s.into_string()) { Some(Ok(env)) => { let mut filter = base_exceptions(EnvFilter::new("")); - for s in env.split(',').into_iter() { + for s in env.split(',') { match s.parse() { Ok(d) => filter = filter.add_directive(d), Err(err) => println!("WARN ignoring log directive: `{}`: {}", s, err), diff --git a/common/src/combat.rs b/common/src/combat.rs index cd8d8c1e95..1099e94a09 100644 --- a/common/src/combat.rs +++ b/common/src/combat.rs @@ -171,7 +171,7 @@ impl Attack { 1.0 - (1.0 - damage_reduction) * (1.0 - block_reduction) } - #[allow(clippy::too_many_arguments)] + #[allow(clippy::too_many_arguments, clippy::redundant_closure)] pub fn apply_attack( &self, attacker: Option, diff --git a/common/src/comp/inventory/item/mod.rs b/common/src/comp/inventory/item/mod.rs index a7fc768a8e..879ce604ee 100644 --- a/common/src/comp/inventory/item/mod.rs +++ b/common/src/comp/inventory/item/mod.rs @@ -779,7 +779,7 @@ impl Item { /// Returns an iterator that drains items contained within the item's slots pub fn drain(&mut self) -> impl Iterator + '_ { - self.slots.iter_mut().filter_map(|x| mem::take(x)) + self.slots.iter_mut().filter_map(mem::take) } pub fn item_definition_id(&self) -> &str { &self.item_def.item_definition_id } diff --git a/common/src/comp/inventory/loadout_builder.rs b/common/src/comp/inventory/loadout_builder.rs index 24446d138d..cb554b7c5c 100644 --- a/common/src/comp/inventory/loadout_builder.rs +++ b/common/src/comp/inventory/loadout_builder.rs @@ -94,9 +94,12 @@ impl ItemSpec { match self { ItemSpec::Item(specifier) => { let item = Item::new_from_asset_expect(specifier); - if !equip_slot.can_hold(&item.kind) { - panic!("Tried to place {} into {:?}", specifier, equip_slot); - } + assert!( + equip_slot.can_hold(&item.kind), + "Tried to place {} into {:?}", + specifier, + equip_slot + ); std::mem::drop(item); }, ItemSpec::Choice(items) => { diff --git a/common/src/comp/inventory/mod.rs b/common/src/comp/inventory/mod.rs index a1347a4dd5..edc953e337 100644 --- a/common/src/comp/inventory/mod.rs +++ b/common/src/comp/inventory/mod.rs @@ -121,7 +121,7 @@ impl Inventory { /// Sorts the inventory using the next sort order pub fn sort(&mut self) { let sort_order = self.next_sort_order; - let mut items: Vec = self.slots_mut().filter_map(|x| mem::take(x)).collect(); + let mut items: Vec = self.slots_mut().filter_map(mem::take).collect(); items.sort_by(|a, b| match sort_order { InventorySortOrder::Name => Ord::cmp(a.name(), b.name()), diff --git a/common/src/lib.rs b/common/src/lib.rs index 40464ae54c..58acc8ed53 100644 --- a/common/src/lib.rs +++ b/common/src/lib.rs @@ -11,7 +11,8 @@ option_zip, trait_alias, type_alias_impl_trait, - extend_one + extend_one, + arbitrary_enum_discriminant )] #![feature(hash_drain_filter)] diff --git a/common/src/recipe.rs b/common/src/recipe.rs index 23309e37f2..0bdb9ac1fa 100644 --- a/common/src/recipe.rs +++ b/common/src/recipe.rs @@ -170,7 +170,7 @@ pub fn try_salvage( let salvage_item = inv.get(slot).expect("Expected item to exist in inventory"); let salvage_output: Vec<_> = salvage_item .salvage_output() - .map(|asset| Item::new_from_asset_expect(asset)) + .map(Item::new_from_asset_expect) .collect(); if salvage_output.is_empty() { // If no output items, assume salvaging was a failure diff --git a/common/src/terrain/sprite.rs b/common/src/terrain/sprite.rs index b62e9c92e6..e174f7ffd4 100644 --- a/common/src/terrain/sprite.rs +++ b/common/src/terrain/sprite.rs @@ -285,8 +285,8 @@ impl SpriteKind { /// What loot table does collecting this sprite draw from? #[inline] pub fn collectible_id(&self) -> Option> { - let item = |id: &'static str| LootSpec::Item(id); - let table = |id: &'static str| LootSpec::LootTable(id); + let item = LootSpec::Item; + let table = LootSpec::LootTable; Some(match self { SpriteKind::Apple => item("common.items.food.apple"), SpriteKind::Mushroom => item("common.items.food.mushroom"), diff --git a/common/src/util/mod.rs b/common/src/util/mod.rs index bfad8f01e9..3aafea07cd 100644 --- a/common/src/util/mod.rs +++ b/common/src/util/mod.rs @@ -18,14 +18,14 @@ lazy_static::lazy_static! { pub static ref GIT_DATE: String = GIT_DATETIME.split('-').take(3).collect::>().join("-"); pub static ref GIT_TIME: &'static str = GIT_DATETIME.split('-').nth(3).expect("failed to retrieve git_time!"); pub static ref DISPLAY_VERSION: String = if GIT_TAG.is_empty() { - format!("{}-{}", VELOREN_VERSION_STAGE, GIT_DATE.to_string()) + format!("{}-{}", VELOREN_VERSION_STAGE, *GIT_DATE) } else { - format!("{}-{}", VELOREN_VERSION_STAGE, GIT_TAG.to_string()) + format!("{}-{}", VELOREN_VERSION_STAGE, GIT_TAG) }; pub static ref DISPLAY_VERSION_LONG: String = if GIT_TAG.is_empty() { - format!("{} ({})", DISPLAY_VERSION.as_str(), GIT_HASH.to_string()) + format!("{} ({})", DISPLAY_VERSION.as_str(), *GIT_HASH) } else { - format!("{} ({})", DISPLAY_VERSION.as_str(), GIT_VERSION.to_string()) + format!("{} ({})", DISPLAY_VERSION.as_str(), GIT_VERSION) }; } diff --git a/common/systems/src/character_behavior.rs b/common/systems/src/character_behavior.rs index 6ff1ab4e55..2050aa3067 100644 --- a/common/systems/src/character_behavior.rs +++ b/common/systems/src/character_behavior.rs @@ -98,14 +98,14 @@ impl<'a> System<'a> for Sys { entity, uid, mut char_state, - mut pos, - mut vel, - mut ori, + pos, + vel, + ori, mass, mut density, energy, inventory, - mut controller, + controller, health, body, physics, @@ -172,14 +172,14 @@ impl<'a> System<'a> for Sys { entity, uid, char_state, - pos: &mut pos, - vel: &mut vel, - ori: &mut ori, + pos, + vel, + ori, mass, density: &mut density, energy, inventory, - controller: &mut controller, + controller, health, body, physics, diff --git a/common/systems/src/phys.rs b/common/systems/src/phys.rs index 39480e8177..c48894fccc 100644 --- a/common/systems/src/phys.rs +++ b/common/systems/src/phys.rs @@ -355,7 +355,7 @@ impl<'a> PhysicsData<'a> { mass, collider, sticky, - mut physics, + physics, projectile, char_state_maybe, )| { @@ -455,7 +455,7 @@ impl<'a> PhysicsData<'a> { &mut collision_registered, &mut entity_entity_collisions, factor, - &mut physics, + physics, char_state_maybe, &mut vel_delta, step_delta, @@ -830,7 +830,7 @@ impl<'a> PhysicsData<'a> { &mut cpos, tgt_pos, &mut vel, - &mut physics_state, + physics_state, Vec3::zero(), &read.dt, was_on_ground, @@ -862,7 +862,7 @@ impl<'a> PhysicsData<'a> { &mut cpos, tgt_pos, &mut vel, - &mut physics_state, + physics_state, Vec3::zero(), &read.dt, was_on_ground, diff --git a/rust-toolchain b/rust-toolchain index 7ed28ef3a2..98f2112ea9 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2021-09-24 +nightly-2021-11-24 diff --git a/server/src/cmd.rs b/server/src/cmd.rs index 1117ed3a37..cd001dcdd0 100644 --- a/server/src/cmd.rs +++ b/server/src/cmd.rs @@ -969,7 +969,7 @@ fn handle_time( 0, ); let msg = match current_time { - Some(time) => format!("It is {}", time.format("%H:%M").to_string()), + Some(time) => format!("It is {}", time.format("%H:%M")), None => String::from("Unknown Time"), }; server.notify_client( @@ -1000,7 +1000,7 @@ fn handle_time( client, ServerGeneral::server_msg( ChatType::CommandInfo, - format!("Time changed to: {}", new_time.format("%H:%M").to_string(),), + format!("Time changed to: {}", new_time.format("%H:%M")), ), ); } @@ -2952,8 +2952,8 @@ fn handle_version( ChatType::CommandInfo, format!( "Server is running {}[{}]", - common::util::GIT_HASH.to_string(), - common::util::GIT_DATE.to_string(), + *common::util::GIT_HASH, + *common::util::GIT_DATE, ), ), ); diff --git a/server/src/events/trade.rs b/server/src/events/trade.rs index 84277a9b73..f9ba077dd9 100644 --- a/server/src/events/trade.rs +++ b/server/src/events/trade.rs @@ -119,7 +119,7 @@ pub fn handle_process_trade_action( .ecs() .read_component::() .get(e) - .map(|i| ReducedInventory::from(i)); + .map(ReducedInventory::from); // Get price info from the first Agent in the trade (currently, an // Agent will never initiate a trade with another agent though) #[cfg(feature = "worldgen")] diff --git a/server/src/lib.rs b/server/src/lib.rs index 8f60e18e5d..4054577923 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -445,7 +445,7 @@ impl Server { state.ecs_mut().write_resource::().0 = settings.start_time; // Register trackers - sys::sentinel::register_trackers(&mut state.ecs_mut()); + sys::sentinel::register_trackers(state.ecs_mut()); state.ecs_mut().insert(DeletedEntities::default()); diff --git a/server/src/persistence/character/conversions.rs b/server/src/persistence/character/conversions.rs index 6f01da3c2c..4544c7da34 100644 --- a/server/src/persistence/character/conversions.rs +++ b/server/src/persistence/character/conversions.rs @@ -481,7 +481,7 @@ pub fn convert_body_from_database( _ => { return Err(PersistenceError::ConversionError(format!( "{} is not a supported body type for deserialization", - variant.to_string() + variant ))); }, }) @@ -516,8 +516,7 @@ fn get_item_from_asset(item_definition_id: &str) -> Result System<'a> for Sys { } } } - } + }, _ => {}, } @@ -1464,7 +1464,7 @@ impl<'a> AgentData<'a> { { value += data.strength * data.duration.map_or(0.0, |d| d.as_secs() as f32); - } + }, _ => {}, } } diff --git a/server/src/sys/msg/register.rs b/server/src/sys/msg/register.rs index e5e0f5ea57..7743c5d35e 100644 --- a/server/src/sys/msg/register.rs +++ b/server/src/sys/msg/register.rs @@ -107,7 +107,7 @@ impl<'a> System<'a> for Sys { let mut finished_pending = vec![]; let mut retries = vec![]; - for (entity, client, mut pending) in + for (entity, client, pending) in (&read_data.entities, &read_data.clients, &mut pending_logins).join() { if let Err(e) = || -> std::result::Result<(), crate::error::Error> { @@ -121,7 +121,7 @@ impl<'a> System<'a> for Sys { }; let (username, uuid) = match login_provider.login( - &mut pending, + pending, #[cfg(feature = "plugins")] &ecs_world, #[cfg(feature = "plugins")] diff --git a/server/src/sys/terrain.rs b/server/src/sys/terrain.rs index cc42738159..55d7429797 100644 --- a/server/src/sys/terrain.rs +++ b/server/src/sys/terrain.rs @@ -378,6 +378,8 @@ impl<'a> System<'a> for Sys { /// Convinient structure to use when you need to create new npc /// from EntityInfo // TODO: better name? +// TODO: if this is send around network, optimize the large_enum_variant +#[allow(clippy::large_enum_variant)] pub enum NpcData { Data { pos: Pos, diff --git a/voxygen/src/hud/bag.rs b/voxygen/src/hud/bag.rs index 9b52b62dca..c97207c3be 100644 --- a/voxygen/src/hud/bag.rs +++ b/voxygen/src/hud/bag.rs @@ -386,7 +386,7 @@ impl<'a> InventoryScroller<'a> { if self.show_salvage && item.is_salvageable() { let salvage_result: Vec<_> = item .salvage_output() - .map(|asset| Arc::::load_expect_cloned(asset)) + .map(Arc::::load_expect_cloned) .map(|item| item as Arc) .collect(); diff --git a/voxygen/src/hud/chat.rs b/voxygen/src/hud/chat.rs index 43edfbc071..f1aea0ee3f 100644 --- a/voxygen/src/hud/chat.rs +++ b/voxygen/src/hud/chat.rs @@ -343,7 +343,7 @@ impl<'a> Widget for Chat<'a> { // Chat input uses a rectangle as its background. if input_focused { // Shallow comparison of ChatMode. - let discrim = |x| std::mem::discriminant(x); + let discrim = std::mem::discriminant; if discrim(&state.input.mode) != discrim(&self.client.chat_mode) { state.update(|s| { s.input.mode = self.client.chat_mode.clone(); diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index f6653a6fcd..d4fdb380de 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -2348,15 +2348,12 @@ impl Hud { (time_in_seconds as u64 % 86400) as u32, 0, ); - Text::new(&format!( - "Time: {}", - current_time.format("%H:%M").to_string() - )) - .color(TEXT_COLOR) - .down_from(self.ids.loaded_distance, V_PAD) - .font_id(self.fonts.cyri.conrod_id) - .font_size(self.fonts.cyri.scale(14)) - .set(self.ids.time, ui_widgets); + Text::new(&format!("Time: {}", current_time.format("%H:%M"))) + .color(TEXT_COLOR) + .down_from(self.ids.loaded_distance, V_PAD) + .font_id(self.fonts.cyri.conrod_id) + .font_size(self.fonts.cyri.scale(14)) + .set(self.ids.time, ui_widgets); // Number of entities let entity_count = client.state().ecs().entities().join().count(); @@ -3875,7 +3872,7 @@ impl Hud { // thread pool let _pool = client.state().ecs().read_resource::(); self.ui.maintain( - &mut global_state.window.renderer_mut(), + global_state.window.renderer_mut(), None, //Some(&pool), Some(proj_mat * view_mat * Mat4::translation_3d(-focus_off)), diff --git a/voxygen/src/hud/overhead.rs b/voxygen/src/hud/overhead.rs index e021a92d81..231f19915d 100644 --- a/voxygen/src/hud/overhead.rs +++ b/voxygen/src/hud/overhead.rs @@ -148,12 +148,12 @@ impl<'a> Ingameable for Overhead<'a> { } else { 0 } - + if info.health.map_or(false, |h| should_show_healthbar(h)) { + + if info.health.map_or(false, should_show_healthbar) { 5 + if info.energy.is_some() { 1 } else { 0 } } else { 0 } - + if info.health.map_or(false, |h| decayed_health_displayed(h)) { + + if info.health.map_or(false, decayed_health_displayed) { 1 } else { 0 @@ -446,7 +446,7 @@ impl<'a> Widget for Overhead<'a> { .parent(id) .set(state.ids.level, ui); } - } + }, _ => {}, } } diff --git a/voxygen/src/hud/skillbar.rs b/voxygen/src/hud/skillbar.rs index b3001fac41..599f0da3e9 100644 --- a/voxygen/src/hud/skillbar.rs +++ b/voxygen/src/hud/skillbar.rs @@ -610,7 +610,7 @@ impl<'a> Skillbar<'a> { .abilities .get(i) .and_then(|a| Ability::from(*a).ability_id(Some(inventory))) - .map(|id| util::ability_description(id)), + .map(util::ability_description), }) }; diff --git a/voxygen/src/hud/social.rs b/voxygen/src/hud/social.rs index 6af6a1494e..bb2fbe5967 100644 --- a/voxygen/src/hud/social.rs +++ b/voxygen/src/hud/social.rs @@ -256,7 +256,7 @@ impl<'a> Widget for Social<'a> { None => format!( "{} [{}]", alias.clone(), - self.localized_strings.get("hud.group.in_menu").to_string() + self.localized_strings.get("hud.group.in_menu") ), // character select or spectating }; let acc_name_txt = format!( diff --git a/voxygen/src/hud/trade.rs b/voxygen/src/hud/trade.rs index 30db6aa617..1664cb2f97 100644 --- a/voxygen/src/hud/trade.rs +++ b/voxygen/src/hud/trade.rs @@ -546,7 +546,7 @@ impl<'a> Widget for Trade<'a> { fn update(mut self, args: widget::UpdateArgs) -> Self::Event { common_base::prof_span!("Trade::update"); - let widget::UpdateArgs { mut state, ui, .. } = args; + let widget::UpdateArgs { state, ui, .. } = args; let mut event = None; let (trade, prices) = match self.client.pending_trade() { @@ -572,18 +572,14 @@ impl<'a> Widget for Trade<'a> { }); } - self.background(&mut state, ui); - self.title(&mut state, ui); - self.phase_indicator(&mut state, ui, trade); + self.background(state, ui); + self.title(state, ui); + self.phase_indicator(state, ui, trade); - event = self - .item_pane(&mut state, ui, trade, prices, false) - .or(event); - event = self - .item_pane(&mut state, ui, trade, prices, true) - .or(event); - event = self.accept_decline_buttons(&mut state, ui, trade).or(event); - event = self.close_button(&mut state, ui).or(event); + event = self.item_pane(state, ui, trade, prices, false).or(event); + event = self.item_pane(state, ui, trade, prices, true).or(event); + event = self.accept_decline_buttons(state, ui, trade).or(event); + event = self.close_button(state, ui).or(event); event } diff --git a/voxygen/src/main.rs b/voxygen/src/main.rs index 03636809f1..0beb9582b9 100644 --- a/voxygen/src/main.rs +++ b/voxygen/src/main.rs @@ -125,8 +125,8 @@ fn main() { logs_dir.join(&log_filename).display(), reason, panic_info, - common::util::GIT_HASH.to_string(), - common::util::GIT_DATE.to_string() + *common::util::GIT_HASH, + *common::util::GIT_DATE ); error!( diff --git a/voxygen/src/menu/char_selection/ui/mod.rs b/voxygen/src/menu/char_selection/ui/mod.rs index 7955fdbd91..62f7d99efd 100644 --- a/voxygen/src/menu/char_selection/ui/mod.rs +++ b/voxygen/src/menu/char_selection/ui/mod.rs @@ -812,8 +812,14 @@ impl Controls { }; // TODO: tooltips - let [ref mut human_button, ref mut orc_button, ref mut dwarf_button, ref mut elf_button, ref mut undead_button, ref mut danari_button] = - species_buttons; + let [ + ref mut human_button, + ref mut orc_button, + ref mut dwarf_button, + ref mut elf_button, + ref mut undead_button, + ref mut danari_button, + ] = species_buttons; let species = Column::with_children(vec![ Row::with_children(vec![ icon_button_tooltip( @@ -874,8 +880,14 @@ impl Controls { ]) .spacing(1); - let [ref mut sword_button, ref mut swords_button, ref mut axe_button, ref mut hammer_button, ref mut bow_button, ref mut staff_button] = - tool_buttons; + let [ + ref mut sword_button, + ref mut swords_button, + ref mut axe_button, + ref mut hammer_button, + ref mut bow_button, + ref mut staff_button, + ] = tool_buttons; let tool = Column::with_children(vec![ Row::with_children(vec![ icon_button_tooltip( @@ -1245,7 +1257,7 @@ impl Controls { i18n.get("main.login.server_version"), mismatched_version, i18n.get("main.login.client_version"), - common::util::GIT_HASH.to_string() + *common::util::GIT_HASH )) .size(self.fonts.cyri.scale(18)) .color(iced::Color::from_rgb(1.0, 0.0, 0.0)) @@ -1356,11 +1368,11 @@ impl Controls { *offhand = value.1; inventory.replace_loadout_item( EquipSlot::ActiveMainhand, - mainhand.map(|specifier| Item::new_from_asset_expect(specifier)), + mainhand.map(Item::new_from_asset_expect), ); inventory.replace_loadout_item( EquipSlot::ActiveOffhand, - offhand.map(|specifier| Item::new_from_asset_expect(specifier)), + offhand.map(Item::new_from_asset_expect), ); } }, diff --git a/voxygen/src/mesh/terrain.rs b/voxygen/src/mesh/terrain.rs index 90fc6c0db8..ce071eca39 100644 --- a/voxygen/src/mesh/terrain.rs +++ b/voxygen/src/mesh/terrain.rs @@ -381,6 +381,7 @@ pub fn generate_mesh<'a, V: RectRasterableVol + ReadVol + Debug + ' let get_color = |_: &mut (), pos: Vec3| flat_get(pos).get_color().unwrap_or_else(Rgb::zero); let get_opacity = |_: &mut (), pos: Vec3| !flat_get(pos).is_opaque(); + #[allow(clippy::redundant_closure)] let flat_get = |pos| flat_get(pos); let should_draw = |_: &mut (), pos: Vec3, delta: Vec3, _uv| { should_draw_greedy(pos, delta, flat_get) diff --git a/voxygen/src/render/renderer/drawer.rs b/voxygen/src/render/renderer/drawer.rs index 2a22eda9a1..95581b33cf 100644 --- a/voxygen/src/render/renderer/drawer.rs +++ b/voxygen/src/render/renderer/drawer.rs @@ -393,7 +393,7 @@ impl<'frame> Drawer<'frame> { ); self.borrow.egui_render_pass.execute( - &mut self.encoder.as_mut().unwrap(), + self.encoder.as_mut().unwrap(), self.taking_screenshot .as_ref() .map_or(&self.swap_tex.view, |s| s.texture_view()), diff --git a/voxygen/src/render/renderer/pipeline_creation.rs b/voxygen/src/render/renderer/pipeline_creation.rs index 3ec6f4f479..6a1552108b 100644 --- a/voxygen/src/render/renderer/pipeline_creation.rs +++ b/voxygen/src/render/renderer/pipeline_creation.rs @@ -415,8 +415,8 @@ fn create_ingame_and_shadow_pipelines( clouds_task, bloom_task, postprocess_task, - // TODO: if these are ever actually optionally done, counting them - // as tasks to do beforehand seems kind of iffy since they will just + // TODO: if these are ever actually optionally done, counting them + // as tasks to do beforehand seems kind of iffy since they will just // be skipped point_shadow_task, terrain_directed_shadow_task, diff --git a/voxygen/src/session/mod.rs b/voxygen/src/session/mod.rs index 8afdd4c178..a00fd876b6 100644 --- a/voxygen/src/session/mod.rs +++ b/voxygen/src/session/mod.rs @@ -111,9 +111,9 @@ impl SessionState { #[cfg(not(target_os = "macos"))] if let Some(uid) = client.uid() { let identiy = if let Some(info) = client.player_list().get(&uid) { - format!("{}-{}", info.player_alias, uid.to_string()) + format!("{}-{}", info.player_alias, uid) } else { - format!("unknown-{}", uid.to_string()) + format!("unknown-{}", uid) }; mumble_link.set_identity(&identiy); // TODO: evaluate context @@ -285,11 +285,7 @@ impl SessionState { client::Event::Kicked(reason) => { global_state.info_message = Some(format!( "{}: {}", - global_state - .i18n - .read() - .get("main.login.kicked") - .to_string(), + global_state.i18n.read().get("main.login.kicked"), reason )); return Ok(TickAction::Disconnect); @@ -842,7 +838,7 @@ impl PlayState for SessionState { }, _ => {}, } - } + }, Event::AnalogGameInput(input) => match input { AnalogGameInput::MovementX(v) => { self.key_state.analog_matrix.x = v; @@ -1502,7 +1498,7 @@ impl PlayState for SessionState { /// Render the session to the screen. /// /// This method should be called once per frame. - fn render<'a>(&'a self, mut drawer: &mut Drawer<'a>, settings: &Settings) { + fn render<'a>(&'a self, drawer: &mut Drawer<'a>, settings: &Settings) { span!(_guard, "render", "::render"); // Render world @@ -1529,7 +1525,7 @@ impl PlayState for SessionState { }; self.scene.render( - &mut drawer, + drawer, client.state(), client.entity(), client.get_tick(), diff --git a/voxygen/src/ui/widgets/slot.rs b/voxygen/src/ui/widgets/slot.rs index b26006b9f8..f743543750 100644 --- a/voxygen/src/ui/widgets/slot.rs +++ b/voxygen/src/ui/widgets/slot.rs @@ -317,7 +317,7 @@ where if *id == widget && !filled => { self.state = ManagerState::Idle; - } + }, _ => (), } diff --git a/world/src/layer/tree.rs b/world/src/layer/tree.rs index 94a498c202..2826eb0d8f 100644 --- a/world/src/layer/tree.rs +++ b/world/src/layer/tree.rs @@ -35,6 +35,7 @@ static QUIRKY_RAND: RandomPerm = RandomPerm::new(0xA634460F); pub fn apply_trees_to(canvas: &mut Canvas, dynamic_rng: &mut impl Rng) { // TODO: Get rid of this + #[allow(clippy::large_enum_variant)] enum TreeModel { Structure(Structure), Procedural(ProceduralTree, StructureBlock), diff --git a/world/src/lib.rs b/world/src/lib.rs index a77b3bcad3..4baad5f24f 100644 --- a/world/src/lib.rs +++ b/world/src/lib.rs @@ -7,7 +7,12 @@ )] #![allow(clippy::branches_sharing_code)] // TODO: evaluate #![deny(clippy::clone_on_ref_ptr)] -#![feature(bool_to_option, const_panic, label_break_value, option_zip)] +#![feature( + bool_to_option, + label_break_value, + option_zip, + arbitrary_enum_discriminant +)] mod all; mod block; diff --git a/world/src/sim/erosion.rs b/world/src/sim/erosion.rs index 037af9e0f7..0187b2ff6b 100644 --- a/world/src/sim/erosion.rs +++ b/world/src/sim/erosion.rs @@ -1750,7 +1750,10 @@ pub(crate) fn fill_sinks( let range = 0..map_size_lg.chunks_len(); let oldh = range .into_par_iter() - .map(|posi| h(posi)) + .map( + #[allow(clippy::redundant_closure)] + |posi| h(posi), + ) .collect::>() .into_boxed_slice(); let mut newh = oldh @@ -2574,7 +2577,10 @@ pub fn do_erosion( // Stream power law slope exponent--link between channel slope and erosion rate. let n = (0..map_size_lg.chunks_len()) .into_par_iter() - .map(|posi| n(posi)) + .map( + #[allow(clippy::redundant_closure)] + |posi| n(posi), + ) .collect::>() .into_boxed_slice(); // Stream power law concavity index (θ = m/n), turned into an exponent on @@ -2587,29 +2593,44 @@ pub fn do_erosion( // Stream power law erodability constant for fluvial erosion (bedrock) let kf = (0..map_size_lg.chunks_len()) .into_par_iter() - .map(|posi| kf(posi)) + .map( + #[allow(clippy::redundant_closure)] + |posi| kf(posi), + ) .collect::>() .into_boxed_slice(); // Stream power law erodability constant for hillslope diffusion (bedrock) let kd = (0..map_size_lg.chunks_len()) .into_par_iter() - .map(|posi| kd(posi)) + .map( + #[allow(clippy::redundant_closure)] + |posi| kd(posi), + ) .collect::>() .into_boxed_slice(); // Deposition coefficient let g = (0..map_size_lg.chunks_len()) .into_par_iter() - .map(|posi| g(posi)) + .map( + #[allow(clippy::redundant_closure)] + |posi| g(posi), + ) .collect::>() .into_boxed_slice(); let epsilon_0 = (0..map_size_lg.chunks_len()) .into_par_iter() - .map(|posi| epsilon_0(posi)) + .map( + #[allow(clippy::redundant_closure)] + |posi| epsilon_0(posi), + ) .collect::>() .into_boxed_slice(); let alpha = (0..map_size_lg.chunks_len()) .into_par_iter() - .map(|posi| alpha(posi)) + .map( + #[allow(clippy::redundant_closure)] + |posi| alpha(posi), + ) .collect::>() .into_boxed_slice(); let mut wh = vec![0.0; map_size_lg.chunks_len()].into_boxed_slice(); @@ -2655,8 +2676,13 @@ pub fn do_erosion( let g = |posi: usize| g[posi]; let epsilon_0 = |posi: usize| epsilon_0[posi]; let alpha = |posi: usize| alpha[posi]; + #[allow(clippy::redundant_closure)] let height_scale = |n| height_scale(n); + #[allow(clippy::redundant_closure)] let k_da_scale = |q| k_da_scale(q); + #[allow(clippy::redundant_closure)] + let is_ocean = |posi| is_ocean(posi); + (0..n_steps).for_each(|i| { debug!("Erosion iteration #{:?}", i); erode( @@ -2677,7 +2703,7 @@ pub fn do_erosion( g, epsilon_0, alpha, - |posi| is_ocean(posi), + is_ocean, height_scale, k_da_scale, threadpool, diff --git a/world/src/sim/mod.rs b/world/src/sim/mod.rs index f8616af117..7bd0a80e1e 100644 --- a/world/src/sim/mod.rs +++ b/world/src/sim/mod.rs @@ -624,7 +624,7 @@ impl WorldSim { // // Based on this estimate, we have: // delta_t_scale ≡ (Δt / Δt') = time_scale - let delta_t_scale = |n: f32| time_scale(n); + let delta_t_scale = time_scale; // alpha_scale ≡ (α / α') = height_scale^(-1) let alpha_scale = |n: f32| height_scale(n).recip() as f32; // diff --git a/world/src/sim2/mod.rs b/world/src/sim2/mod.rs index 754e7f9e47..02a133201c 100644 --- a/world/src/sim2/mod.rs +++ b/world/src/sim2/mod.rs @@ -826,7 +826,7 @@ pub fn tick_site_economy( site.economy.marginal_surplus = demand.map(|g, demand| supply[g] - demand); // plan trading with other sites - let mut external_orders = &mut index.trade.orders; + let external_orders = &mut index.trade.orders; let mut potential_trade = GoodMap::from_default(0.0); // use last year's generated transportation for merchants (could we do better? // this is in line with the other professions) @@ -836,7 +836,7 @@ pub fn tick_site_economy( site, &site_id, transportation_capacity, - &mut external_orders, + external_orders, &mut potential_trade, ); site.economy.active_exports = GoodMap::from_iter(trade.iter().map(|(g, a)| (g, -*a)), 0.0); // TODO: check for availability? diff --git a/world/src/site2/tile.rs b/world/src/site2/tile.rs index f5272d9d6c..86019a2f4e 100644 --- a/world/src/site2/tile.rs +++ b/world/src/site2/tile.rs @@ -106,25 +106,25 @@ impl TileGrid { { aabr.max.x += 1; last_growth = i; - } + }, 1 if (aabr.min.x..aabr.max.x + 1) .all(|x| self.get(Vec2::new(x, aabr.max.y)).is_empty()) => { aabr.max.y += 1; last_growth = i; - } + }, 2 if (aabr.min.y..aabr.max.y + 1) .all(|y| self.get(Vec2::new(aabr.min.x - 1, y)).is_empty()) => { aabr.min.x -= 1; last_growth = i; - } + }, 3 if (aabr.min.x..aabr.max.x + 1) .all(|x| self.get(Vec2::new(x, aabr.min.y - 1)).is_empty()) => { aabr.min.y -= 1; last_growth = i; - } + }, _ => {}, } } From dde6404af83d5e48a0c8dc2375fa47670a0f3510 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=A4rtens?= Date: Wed, 24 Nov 2021 22:17:08 +0100 Subject: [PATCH 2/2] update cache_image_tag --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4d1a6da35b..537ef56aea 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,7 +13,7 @@ variables: # https://docs.gitlab.com/ee/ci/yaml/#shallow-cloning GIT_DEPTH: 3 GIT_CLEAN_FLAGS: -f - CACHE_IMAGE_TAG: f4db383e + CACHE_IMAGE_TAG: a4f7c998 default: # https://docs.gitlab.com/ee/ci/pipelines/settings.html#auto-cancel-pending-pipelines