diff --git a/.cargo/config b/.cargo/config index 4407be603f..263cedb682 100644 --- a/.cargo/config +++ b/.cargo/config @@ -13,3 +13,5 @@ test-voxygen = "run --bin veloren-voxygen --no-default-features --features gl,si tracy-voxygen = "-Zunstable-options run --bin veloren-voxygen --no-default-features --features tracy,gl,simd --profile no_overflow" server = "run --bin veloren-server-cli" +[env] +RUSTC_FORCE_INCREMENTAL = "1" diff --git a/Cargo.lock b/Cargo.lock index 3ccaed6fb5..3fb5eb69dd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3562,9 +3562,9 @@ dependencies = [ [[package]] name = "packed_simd_2" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3278e0492f961fd4ae70909f56b2723a7e8d01a228427294e19cdfdebda89a17" +checksum = "0e64858a2d3733fdd61adfdd6da89aa202f7ff0e741d2fc7ed1e452ba9dc99d7" dependencies = [ "cfg-if 0.1.10", "libm 0.1.4", diff --git a/Cargo.toml b/Cargo.toml index 90fc87e346..99aeca6154 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,8 +34,7 @@ panic = "abort" debug = false codegen-units = 8 lto = false -# TEMP false to avoid fingerprints bug -incremental = false +incremental = true # All dependencies (but not this crate itself) [profile.dev.package."*"] opt-level = 3 @@ -52,7 +51,6 @@ opt-level = 2 [profile.dev.package."veloren-server-cli"] opt-level = 2 [profile.dev.package."veloren-voxygen"] -incremental = true opt-level = 2 [profile.dev.package."veloren-world"] opt-level = 2 diff --git a/common/net/src/msg/client.rs b/common/net/src/msg/client.rs index 0da0c8c360..9252e5ec85 100644 --- a/common/net/src/msg/client.rs +++ b/common/net/src/msg/client.rs @@ -12,7 +12,7 @@ use vek::*; /// streams though). It's used to verify the correctness of the state in /// debug_assertions #[derive(Debug, Clone)] -#[allow(clippy::clippy::large_enum_variant)] +#[allow(clippy::large_enum_variant)] // TODO: this is used for pings so we should probably look into lowering enum size (doesn't effect bandwidth but could effect CPU costs) pub enum ClientMsg { ///Send on the first connection ONCE to identify client intention for /// server diff --git a/common/net/src/msg/server.rs b/common/net/src/msg/server.rs index 818f49c38f..05450e4db9 100644 --- a/common/net/src/msg/server.rs +++ b/common/net/src/msg/server.rs @@ -49,7 +49,7 @@ pub struct ServerInfo { /// Reponse To ClientType #[derive(Debug, Clone, Serialize, Deserialize)] -#[allow(clippy::clippy::large_enum_variant)] +#[allow(clippy::large_enum_variant)] pub enum ServerInit { TooManyPlayers, GameSync { diff --git a/common/src/comp/body/object.rs b/common/src/comp/body/object.rs index 6de2c5ca86..6f8eb252e6 100644 --- a/common/src/comp/body/object.rs +++ b/common/src/comp/body/object.rs @@ -172,7 +172,7 @@ impl From for super::Body { } impl Body { - pub fn to_string(&self) -> &str { + pub fn to_string(self) -> &'static str { match self { Body::Arrow => "arrow", Body::Bomb => "bomb", diff --git a/common/src/comp/inventory/mod.rs b/common/src/comp/inventory/mod.rs index 36ba9cd2c9..a08b7d1a0e 100644 --- a/common/src/comp/inventory/mod.rs +++ b/common/src/comp/inventory/mod.rs @@ -607,6 +607,7 @@ impl Inventory { /// Unequip an item from slot and place into inventory. Will leave the item /// equipped if inventory has no slots available. #[must_use = "Returned items will be lost if not used"] + #[allow(clippy::needless_collect)] // This is a false positive, the collect is needed pub fn unequip(&mut self, equip_slot: EquipSlot) -> Result>, SlotError> { // Ensure there is enough space in the inventory to place the unequipped item if self.free_slots_minus_equipped_item(equip_slot) == 0 { diff --git a/common/src/comp/inventory/test.rs b/common/src/comp/inventory/test.rs index fae0a8174c..f2acbb1775 100644 --- a/common/src/comp/inventory/test.rs +++ b/common/src/comp/inventory/test.rs @@ -130,9 +130,7 @@ fn free_slots_minus_equipped_item_items_only_present_in_equipped_bag_slots() { inv.loadout .swap(bag1_slot, Some(bag.duplicate(ability_map, msm))); - inv.insert_at(InvSlotId::new(15, 0), bag) - .unwrap() - .unwrap_none(); + assert!(inv.insert_at(InvSlotId::new(15, 0), bag).unwrap().is_none()); let result = inv.free_slots_minus_equipped_item(bag1_slot); @@ -156,9 +154,7 @@ fn free_slots_minus_equipped_item() { Some(bag.duplicate(ability_map, msm)), ); - inv.insert_at(InvSlotId::new(16, 0), bag) - .unwrap() - .unwrap_none(); + assert!(inv.insert_at(InvSlotId::new(16, 0), bag).unwrap().is_none()); let result = inv.free_slots_minus_equipped_item(bag1_slot); @@ -247,7 +243,7 @@ fn unequip_items_both_hands() { // We have space in the inventory, so this should have unequipped assert_eq!(None, inv.equipped(EquipSlot::ActiveMainhand)); assert_eq!(18, inv.populated_slots()); - assert_eq!(true, result.is_ok()); + assert!(result.is_ok()); let result = inv.unequip(EquipSlot::InactiveMainhand).unwrap_err(); assert_eq!(SlotError::InventoryFull, result); @@ -303,9 +299,11 @@ fn equip_equipping_smaller_bag_from_last_slot_of_big_bag() { let small_bag = get_test_bag(9); let large_bag = Item::new_from_asset_expect(LARGE_BAG_ID); - inv.loadout - .swap(EquipSlot::Armor(ArmorSlot::Bag1), Some(large_bag)) - .unwrap_none(); + assert!( + inv.loadout + .swap(EquipSlot::Armor(ArmorSlot::Bag1), Some(large_bag)) + .is_none() + ); inv.insert_at(InvSlotId::new(15, 15), small_bag).unwrap(); @@ -326,9 +324,11 @@ fn unequip_unequipping_bag_into_its_own_slot_with_no_other_free_slots() { let mut inv = Inventory::new_empty(); let bag = get_test_bag(9); - inv.loadout - .swap(EquipSlot::Armor(ArmorSlot::Bag1), Some(bag)) - .unwrap_none(); + assert!( + inv.loadout + .swap(EquipSlot::Armor(ArmorSlot::Bag1), Some(bag)) + .is_none() + ); // Fill all inventory built-in slots fill_inv_slots(&mut inv, 18); @@ -345,12 +345,14 @@ fn equip_one_bag_equipped_equip_second_bag() { let mut inv = Inventory::new_empty(); let bag = get_test_bag(9); - inv.loadout - .swap( - EquipSlot::Armor(ArmorSlot::Bag1), - Some(bag.duplicate(ability_map, msm)), - ) - .unwrap_none(); + assert!( + inv.loadout + .swap( + EquipSlot::Armor(ArmorSlot::Bag1), + Some(bag.duplicate(ability_map, msm)), + ) + .is_none() + ); inv.push(bag).unwrap(); @@ -364,9 +366,11 @@ fn free_after_swap_equipped_item_has_more_slots() { let mut inv = Inventory::new_empty(); let bag = get_test_bag(18); - inv.loadout - .swap(EquipSlot::Armor(ArmorSlot::Bag1), Some(bag)) - .unwrap_none(); + assert!( + inv.loadout + .swap(EquipSlot::Armor(ArmorSlot::Bag1), Some(bag)) + .is_none() + ); let small_bag = get_test_bag(9); inv.push(small_bag).unwrap(); @@ -385,9 +389,11 @@ fn free_after_swap_equipped_item_has_less_slots() { let mut inv = Inventory::new_empty(); let bag = get_test_bag(9); - inv.loadout - .swap(EquipSlot::Armor(ArmorSlot::Bag1), Some(bag)) - .unwrap_none(); + assert!( + inv.loadout + .swap(EquipSlot::Armor(ArmorSlot::Bag1), Some(bag)) + .is_none() + ); let small_bag = get_test_bag(18); inv.push(small_bag).unwrap(); @@ -406,9 +412,11 @@ fn free_after_swap_equipped_item_with_slots_swapped_with_empty_inv_slot() { let mut inv = Inventory::new_empty(); let bag = get_test_bag(9); - inv.loadout - .swap(EquipSlot::Armor(ArmorSlot::Bag1), Some(bag)) - .unwrap_none(); + assert!( + inv.loadout + .swap(EquipSlot::Armor(ArmorSlot::Bag1), Some(bag)) + .is_none() + ); // Add 5 items to the inventory fill_inv_slots(&mut inv, 5); diff --git a/common/src/comp/skills.rs b/common/src/comp/skills.rs index 320bd6b1f6..e1c113d8f2 100644 --- a/common/src/comp/skills.rs +++ b/common/src/comp/skills.rs @@ -670,7 +670,7 @@ mod tests { assert_eq!(skillset.skill_groups[1].available_sp, 0); assert_eq!(skillset.skills.len(), 1); - assert_eq!(skillset.has_skill(Skill::Axe(AxeSkill::UnlockLeap)), true); + assert!(skillset.has_skill(Skill::Axe(AxeSkill::UnlockLeap))); skillset.refund_skill(Skill::Axe(AxeSkill::UnlockLeap)); @@ -705,7 +705,7 @@ mod tests { assert_eq!(skillset.skill_groups[1].available_sp, 0); assert_eq!(skillset.skills.len(), 1); - assert_eq!(skillset.has_skill(Skill::Axe(AxeSkill::UnlockLeap)), true); + assert!(skillset.has_skill(Skill::Axe(AxeSkill::UnlockLeap))); // Try unlocking a skill without enough skill points skillset.unlock_skill(Skill::Axe(AxeSkill::DsCombo)); diff --git a/common/src/event.rs b/common/src/event.rs index fc6b0f0cce..1c507d0876 100644 --- a/common/src/event.rs +++ b/common/src/event.rs @@ -204,7 +204,7 @@ impl EventBus { pub fn emit_now(&self, event: E) { self.queue.lock().unwrap().push_back(event); } pub fn recv_all(&self) -> impl ExactSizeIterator { - std::mem::replace(self.queue.lock().unwrap().deref_mut(), VecDeque::new()).into_iter() + std::mem::take(self.queue.lock().unwrap().deref_mut()).into_iter() } } diff --git a/common/src/lib.rs b/common/src/lib.rs index 132fee892a..e5601852f8 100644 --- a/common/src/lib.rs +++ b/common/src/lib.rs @@ -11,8 +11,6 @@ fundamental, iter_map_while, label_break_value, - option_expect_none, - option_unwrap_none, option_zip, or_patterns, trait_alias, diff --git a/common/src/terrain/mod.rs b/common/src/terrain/mod.rs index 39dc773f88..19cc22bdd5 100644 --- a/common/src/terrain/mod.rs +++ b/common/src/terrain/mod.rs @@ -91,7 +91,7 @@ pub struct TerrainChunkMeta { contains_dungeon: bool, } -#[allow(clippy::clippy::too_many_arguments)] +#[allow(clippy::too_many_arguments)] impl TerrainChunkMeta { pub fn new( name: Option, diff --git a/common/systems/src/lib.rs b/common/systems/src/lib.rs index 19596f16b5..8e6f63292a 100644 --- a/common/systems/src/lib.rs +++ b/common/systems/src/lib.rs @@ -1,4 +1,4 @@ -#![feature(bool_to_option, option_unwrap_none, array_map)] +#![feature(bool_to_option, array_map)] #![allow(clippy::option_map_unit_fn)] mod aura; diff --git a/network/protocol/src/types.rs b/network/protocol/src/types.rs index 2e189b412d..98d38985c8 100644 --- a/network/protocol/src/types.rs +++ b/network/protocol/src/types.rs @@ -112,7 +112,7 @@ impl Pid { } #[inline] - pub(crate) fn to_bytes(&self, bytes: &mut BytesMut) { bytes.put_u128_le(self.internal) } + pub(crate) fn to_bytes(self, bytes: &mut BytesMut) { bytes.put_u128_le(self.internal) } } impl Sid { @@ -128,7 +128,7 @@ impl Sid { } #[inline] - pub(crate) fn to_bytes(&self, bytes: &mut BytesMut) { bytes.put_u64_le(self.internal) } + pub(crate) fn to_bytes(self, bytes: &mut BytesMut) { bytes.put_u64_le(self.internal) } } impl std::fmt::Debug for Pid { diff --git a/network/src/api.rs b/network/src/api.rs index 5a3000870b..8efebd731a 100644 --- a/network/src/api.rs +++ b/network/src/api.rs @@ -1159,10 +1159,11 @@ impl Drop for Participant { impl Drop for Stream { #[instrument(name="remote", skip(self), fields(p = %self.remote_pid))] #[instrument(name="network", skip(self), fields(p = %self.local_pid))] + fn drop(&mut self) { // send if closed is unnecessary but doesn't hurt, we must not crash + let sid = self.sid; if !self.send_closed.load(Ordering::Relaxed) { - let sid = self.sid; debug!(?sid, "Shutting down Stream"); if let Err(e) = self.a2b_close_stream_s.take().unwrap().send(self.sid) { debug!( @@ -1171,7 +1172,6 @@ impl Drop for Stream { ); } } else { - let sid = self.sid; trace!(?sid, "Stream Drop not needed"); } } diff --git a/rust-toolchain b/rust-toolchain index 86899ee56c..b2eff28fe0 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2021-03-22 +nightly-2021-05-18 diff --git a/server/src/lib.rs b/server/src/lib.rs index 705f5178b5..b038bfcde4 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -7,7 +7,6 @@ bool_to_option, drain_filter, never_type, - option_unwrap_none, option_zip, unwrap_infallible )] diff --git a/voxygen/anim/src/lib.rs b/voxygen/anim/src/lib.rs index 733c4ec174..d401074bda 100644 --- a/voxygen/anim/src/lib.rs +++ b/voxygen/anim/src/lib.rs @@ -1,5 +1,4 @@ #![feature(const_generics)] -#![feature(or_patterns)] #![feature(generic_associated_types)] #![allow(incomplete_features)] #[cfg(all(feature = "be-dyn-lib", feature = "use-dyn-lib"))] diff --git a/voxygen/src/lib.rs b/voxygen/src/lib.rs index aa2af1d956..ebf188850c 100644 --- a/voxygen/src/lib.rs +++ b/voxygen/src/lib.rs @@ -2,14 +2,7 @@ #![allow(incomplete_features)] #![allow(clippy::option_map_unit_fn)] #![deny(clippy::clone_on_ref_ptr)] -#![feature( - array_map, - bool_to_option, - const_generics, - drain_filter, - once_cell, - or_patterns -)] +#![feature(array_map, bool_to_option, const_generics, drain_filter, once_cell)] #![recursion_limit = "2048"] #[macro_use] diff --git a/voxygen/src/window.rs b/voxygen/src/window.rs index d75cc87785..c4e37e9c61 100644 --- a/voxygen/src/window.rs +++ b/voxygen/src/window.rs @@ -975,13 +975,14 @@ impl Window { if let (true, Some(game_inputs)) = // Mouse input not mapped to input if it is not grabbed ( - self.cursor_grabbed, - Window::map_input( - KeyMouse::Mouse(button), - controls, - &mut self.remapping_keybindings, - ), - ) { + self.cursor_grabbed, + Window::map_input( + KeyMouse::Mouse(button), + controls, + &mut self.remapping_keybindings, + ), + ) + { for game_input in game_inputs { self.events.push(Event::InputUpdate( *game_input, diff --git a/world/Cargo.toml b/world/Cargo.toml index e0f3bc3f84..7975ff460b 100644 --- a/world/Cargo.toml +++ b/world/Cargo.toml @@ -31,7 +31,7 @@ tracing = { version = "0.1", default-features = false } rand = "0.8" rand_chacha = "0.3" arr_macro = "0.1.2" -packed_simd = { version = "0.3.4", package = "packed_simd_2" } +packed_simd = { package = "packed_simd_2", version = "0.3.5" } rayon = "1.5" serde = { version = "1.0.110", features = ["derive"] } ron = { version = "0.6", default-features = false } diff --git a/world/src/lib.rs b/world/src/lib.rs index 1036abb16b..b8ffc2a71e 100644 --- a/world/src/lib.rs +++ b/world/src/lib.rs @@ -12,7 +12,6 @@ const_generics, const_panic, label_break_value, - or_patterns, array_map )] diff --git a/world/src/sim/mod.rs b/world/src/sim/mod.rs index 026eea738f..ec0b4f74aa 100644 --- a/world/src/sim/mod.rs +++ b/world/src/sim/mod.rs @@ -116,17 +116,18 @@ pub(crate) struct GenCtx { pub warp_nz: FastNoise, pub tree_nz: BasicMulti, - pub cave_0_nz: SuperSimplex, - pub cave_1_nz: SuperSimplex, + // TODO: unused, remove??? @zesterer + pub _cave_0_nz: SuperSimplex, + pub _cave_1_nz: SuperSimplex, pub structure_gen: StructureGen2d, - pub big_structure_gen: StructureGen2d, - pub region_gen: StructureGen2d, + pub _big_structure_gen: StructureGen2d, + pub _region_gen: StructureGen2d, - pub fast_turb_x_nz: FastNoise, - pub fast_turb_y_nz: FastNoise, + pub _fast_turb_x_nz: FastNoise, + pub _fast_turb_y_nz: FastNoise, - pub town_gen: StructureGen2d, + pub _town_gen: StructureGen2d, pub river_seed: RandomField, pub rock_strength_nz: Fbm, pub uplift_nz: Worley, @@ -521,22 +522,22 @@ impl WorldSim { .set_octaves(12) .set_persistence(0.75) .set_seed(rng.gen()), - cave_0_nz: SuperSimplex::new().set_seed(rng.gen()), - cave_1_nz: SuperSimplex::new().set_seed(rng.gen()), + _cave_0_nz: SuperSimplex::new().set_seed(rng.gen()), + _cave_1_nz: SuperSimplex::new().set_seed(rng.gen()), structure_gen: StructureGen2d::new(rng.gen(), 24, 10), - big_structure_gen: StructureGen2d::new(rng.gen(), 768, 512), - region_gen: StructureGen2d::new(rng.gen(), 400, 96), + _big_structure_gen: StructureGen2d::new(rng.gen(), 768, 512), + _region_gen: StructureGen2d::new(rng.gen(), 400, 96), humid_nz: Billow::new() .set_octaves(9) .set_persistence(0.4) .set_frequency(0.2) .set_seed(rng.gen()), - fast_turb_x_nz: FastNoise::new(rng.gen()), - fast_turb_y_nz: FastNoise::new(rng.gen()), + _fast_turb_x_nz: FastNoise::new(rng.gen()), + _fast_turb_y_nz: FastNoise::new(rng.gen()), - town_gen: StructureGen2d::new(rng.gen(), 2048, 1024), + _town_gen: StructureGen2d::new(rng.gen(), 2048, 1024), river_seed: RandomField::new(rng.gen()), rock_strength_nz: Fbm::new() .set_octaves(10) diff --git a/world/src/sim/util.rs b/world/src/sim/util.rs index 621ea6bfe5..a414f78f59 100644 --- a/world/src/sim/util.rs +++ b/world/src/sim/util.rs @@ -581,12 +581,12 @@ pub struct HybridMulti { impl HybridMulti { pub const DEFAULT_FREQUENCY: f64 = 2.0; - pub const DEFAULT_LACUNARITY: f64 = /* std::f64::consts::PI * 2.0 / 3.0 */2.0; + pub const DEFAULT_LACUNARITY: f64 = /* std::f64::consts::PI * 2.0 / 3.0 */ 2.0; pub const DEFAULT_OCTAVES: usize = 6; - pub const DEFAULT_OFFSET: f64 = /* 0.25 *//* 0.5*/ 0.7; + pub const DEFAULT_OFFSET: f64 = /* 0.25 *//* 0.5 */ 0.7; // -ln(2^(-0.25))/ln(2) = 0.25 // 2^(-0.25) ~ 13/16 - pub const DEFAULT_PERSISTENCE: f64 = /* 0.25 *//* 0.5*/ 13.0 / 16.0; + pub const DEFAULT_PERSISTENCE: f64 = /* 0.25 *//* 0.5 */ 13.0 / 16.0; pub const DEFAULT_SEED: u32 = 0; pub const MAX_OCTAVES: usize = 32;