diff --git a/Cargo.toml b/Cargo.toml index 99aeca6154..b5fcbfced9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -44,6 +44,8 @@ opt-level = 2 opt-level = 3 [profile.dev.package."veloren-common"] opt-level = 2 +[profile.dev.package."veloren-common-systems"] +incremental = false [profile.dev.package."veloren-client"] opt-level = 2 [profile.dev.package."veloren-server"] diff --git a/common/systems/src/character_behavior.rs b/common/systems/src/character_behavior.rs index 20590f825f..e7db1e0b36 100644 --- a/common/systems/src/character_behavior.rs +++ b/common/systems/src/character_behavior.rs @@ -257,7 +257,7 @@ impl<'a> System<'a> for Sys { } // Controller actions - let actions = std::mem::replace(&mut controller.actions, Vec::new()); + let actions = std::mem::take(&mut controller.actions); let mut join_struct = JoinStruct { entity, diff --git a/plugin/rt/src/lib.rs b/plugin/rt/src/lib.rs index 82ef453eb4..30d37635e3 100644 --- a/plugin/rt/src/lib.rs +++ b/plugin/rt/src/lib.rs @@ -1,5 +1,3 @@ -#![feature(const_fn)] - pub extern crate plugin_derive; pub mod retrieve; diff --git a/server/src/events/inventory_manip.rs b/server/src/events/inventory_manip.rs index 556d40f966..2e91ab1aaa 100644 --- a/server/src/events/inventory_manip.rs +++ b/server/src/events/inventory_manip.rs @@ -781,10 +781,9 @@ mod tests { let position = Pos(Vec3::zero()); let item_position = Pos(Vec3::one()); - assert_eq!( - within_pickup_range(test_cylinder(position), || test_cylinder(item_position),), - true - ); + assert!(within_pickup_range(test_cylinder(position), || { + test_cylinder(item_position) + },),); } #[test] @@ -792,9 +791,8 @@ mod tests { let position = Pos(Vec3::zero()); let item_position = Pos(Vec3::one() * 500.0); - assert_eq!( - within_pickup_range(test_cylinder(position), || test_cylinder(item_position),), - false - ); + assert!(!within_pickup_range(test_cylinder(position), || { + test_cylinder(item_position) + },),); } } diff --git a/server/src/sys/agent.rs b/server/src/sys/agent.rs index fa01525b93..7ac35e0642 100644 --- a/server/src/sys/agent.rs +++ b/server/src/sys/agent.rs @@ -1,3 +1,5 @@ +#![allow(clippy::branches_sharing_code)] // TODO: evaluate + use crate::rtsim::{Entity as RtSimData, RtSim}; use common::{ comp::{ diff --git a/voxygen/src/audio/sfx/event_mapper/movement/tests.rs b/voxygen/src/audio/sfx/event_mapper/movement/tests.rs index 8e9523edfa..919c5187ea 100644 --- a/voxygen/src/audio/sfx/event_mapper/movement/tests.rs +++ b/voxygen/src/audio/sfx/event_mapper/movement/tests.rs @@ -15,7 +15,7 @@ fn no_item_config_no_emit() { let previous_state = PreviousEntityState::default(); let result = MovementEventMapper::should_emit(&previous_state, None); - assert_eq!(result, false); + assert!(!result); } #[test] @@ -39,7 +39,7 @@ fn config_but_played_since_threshold_no_emit() { Some((&SfxEvent::Run(BlockKind::Grass), &trigger_item)), ); - assert_eq!(result, false); + assert!(!result); } #[test] @@ -62,7 +62,7 @@ fn config_and_not_played_since_threshold_emits() { Some((&SfxEvent::Run(BlockKind::Grass), &trigger_item)), ); - assert_eq!(result, true); + assert!(result); } #[test] @@ -87,7 +87,7 @@ fn same_previous_event_elapsed_emits() { Some((&SfxEvent::Run(BlockKind::Grass), &trigger_item)), ); - assert_eq!(result, true); + assert!(result); } #[test] diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index bc8b194fc0..bbc95ff3e9 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -956,7 +956,7 @@ impl Hud { interactable: Option, ) -> Vec { span!(_guard, "update_layout", "Hud::update_layout"); - let mut events = std::mem::replace(&mut self.events, Vec::new()); + let mut events = core::mem::take(&mut self.events); let (ref mut ui_widgets, ref mut item_tooltip_manager, ref mut tooltip_manager) = &mut self.ui.set_widgets(); // self.ui.set_item_widgets(); pulse time for pulsating elements diff --git a/voxygen/src/mesh/terrain.rs b/voxygen/src/mesh/terrain.rs index 7904be3a6e..682e798dd6 100644 --- a/voxygen/src/mesh/terrain.rs +++ b/voxygen/src/mesh/terrain.rs @@ -1,3 +1,5 @@ +#![allow(clippy::clone_on_copy)] // TODO: fix after wgpu branch + use crate::{ mesh::{ greedy::{self, GreedyConfig, GreedyMesh}, diff --git a/voxygen/src/ui/ice/renderer/widget/slider.rs b/voxygen/src/ui/ice/renderer/widget/slider.rs index ec624105bf..7441254555 100644 --- a/voxygen/src/ui/ice/renderer/widget/slider.rs +++ b/voxygen/src/ui/ice/renderer/widget/slider.rs @@ -79,6 +79,7 @@ impl slider::Renderer for IcedRenderer { mouse::Interaction::Idle }; + #[allow(clippy::branches_sharing_code)] // TODO: remove #[allow(clippy::if_same_then_else)] // TODO: remove let primitives = if style.labels { // TODO text label on left and right ends diff --git a/voxygen/src/ui/mod.rs b/voxygen/src/ui/mod.rs index 6999d081d4..64ad6ec49d 100644 --- a/voxygen/src/ui/mod.rs +++ b/voxygen/src/ui/mod.rs @@ -530,6 +530,7 @@ impl Ui { }); if glyph_missing { + #[allow(clippy::branches_sharing_code)] // TODO: evaluate (ask sharp) if *retry { // If a glyph was missing and this was our second try, we know something was // messed up during the glyph_cache redraw. It is possible that diff --git a/voxygen/src/ui/widgets/slot.rs b/voxygen/src/ui/widgets/slot.rs index 055655a3ac..e1a6272b4a 100644 --- a/voxygen/src/ui/widgets/slot.rs +++ b/voxygen/src/ui/widgets/slot.rs @@ -194,8 +194,8 @@ where pub fn maintain(&mut self, ui: &mut conrod_core::UiCell) -> Vec> { // Clear - let slot_ids = std::mem::replace(&mut self.slot_ids, Vec::new()); - let slots = std::mem::replace(&mut self.slots, Vec::new()); + let slot_ids = core::mem::take(&mut self.slot_ids); + let slots = core::mem::take(&mut self.slots); // Detect drops by of selected item by clicking in empty space if let ManagerState::Selected(_, slot) = self.state { @@ -295,7 +295,7 @@ where // } } - std::mem::replace(&mut self.events, Vec::new()) + core::mem::take(&mut self.events) } fn update( diff --git a/world/examples/water.rs b/world/examples/water.rs index 42dd3fad26..0c3da7012b 100644 --- a/world/examples/water.rs +++ b/world/examples/water.rs @@ -1,3 +1,4 @@ +#![allow(clippy::branches_sharing_code)] // TODO: evaluate use common::{ terrain::{ map::{MapConfig, MapDebug, MapSample}, diff --git a/world/src/lib.rs b/world/src/lib.rs index b8ffc2a71e..83f160b68f 100644 --- a/world/src/lib.rs +++ b/world/src/lib.rs @@ -5,6 +5,7 @@ clippy::blocks_in_if_conditions, clippy::too_many_arguments )] +#![allow(clippy::branches_sharing_code)] // TODO: evaluate #![deny(clippy::clone_on_ref_ptr)] #![feature( arbitrary_enum_discriminant,