From 950c62efc61f978c582c44e35385231f2f76a791 Mon Sep 17 00:00:00 2001 From: Ben Wallis Date: Wed, 10 Jun 2020 20:47:36 +0100 Subject: [PATCH] Suppressed all existing clippy warnings in preparation for fixes as part of #587 --- .gitlab/CI/check-compile.gitlab-ci.yml | 2 +- client/src/cmd.rs | 2 ++ client/src/lib.rs | 4 +++ common/src/assets/mod.rs | 2 +- common/src/assets/watch.rs | 4 +++ common/src/comp/inventory/mod.rs | 2 ++ common/src/comp/inventory/slot.rs | 2 ++ common/src/event.rs | 1 + common/src/figure/mod.rs | 2 ++ common/src/loadout_builder.rs | 1 + common/src/msg/ecs_packet.rs | 1 + common/src/path.rs | 2 ++ common/src/region.rs | 3 ++ common/src/spiral.rs | 3 ++ common/src/states/triple_strike.rs | 1 + common/src/states/utils.rs | 1 + common/src/sync/packet.rs | 1 + common/src/sys/agent.rs | 2 ++ common/src/sys/character_behavior.rs | 2 ++ common/src/sys/combat.rs | 1 + common/src/sys/controller.rs | 1 + common/src/sys/mount.rs | 2 ++ common/src/sys/phys.rs | 3 ++ common/src/sys/projectile.rs | 1 + common/src/sys/stats.rs | 1 + common/src/terrain/chonk.rs | 1 + common/src/util/color.rs | 1 + common/src/util/mod.rs | 2 +- common/src/vol.rs | 1 + common/src/volumes/chunk.rs | 1 + common/src/volumes/vol_grid_2d.rs | 1 + server-cli/src/main.rs | 1 + server/src/chunk_generator.rs | 1 + server/src/cmd.rs | 30 +++++++++++++++++++ server/src/events/entity_creation.rs | 1 + server/src/events/entity_manipulation.rs | 3 ++ server/src/events/interaction.rs | 4 +++ server/src/events/inventory_manip.rs | 3 ++ server/src/lib.rs | 2 ++ server/src/metrics.rs | 2 ++ server/src/persistence/character.rs | 2 ++ server/src/persistence/mod.rs | 1 + server/src/settings.rs | 1 + server/src/state_ext.rs | 2 ++ server/src/sys/entity_sync.rs | 2 ++ server/src/sys/message.rs | 5 ++++ server/src/sys/persistence.rs | 1 + server/src/sys/sentinel.rs | 1 + server/src/sys/subscription.rs | 3 ++ server/src/sys/terrain.rs | 6 ++++ server/src/sys/terrain_sync.rs | 1 + server/src/sys/waypoint.rs | 1 + voxygen/benches/meshing_benchmark.rs | 1 + voxygen/examples/character_renderer.rs | 1 + voxygen/src/anim/bird_small/mod.rs | 1 + voxygen/src/anim/character/alpha.rs | 1 + voxygen/src/anim/character/charge.rs | 2 ++ voxygen/src/anim/character/dash.rs | 1 + voxygen/src/anim/character/equip.rs | 1 + voxygen/src/anim/character/gliding.rs | 1 + voxygen/src/anim/character/jump.rs | 1 + voxygen/src/anim/character/mod.rs | 1 + voxygen/src/anim/character/roll.rs | 1 + voxygen/src/anim/character/run.rs | 1 + voxygen/src/anim/character/shoot.rs | 1 + voxygen/src/anim/character/swim.rs | 1 + voxygen/src/anim/character/wield.rs | 1 + voxygen/src/anim/critter/mod.rs | 1 + voxygen/src/anim/fish_medium/mod.rs | 1 + voxygen/src/anim/fish_small/mod.rs | 1 + voxygen/src/anim/fixture/mod.rs | 1 + voxygen/src/anim/golem/mod.rs | 1 + voxygen/src/anim/object/mod.rs | 1 + voxygen/src/audio/fader.rs | 4 +++ voxygen/src/audio/mod.rs | 2 ++ voxygen/src/audio/music.rs | 1 + .../src/audio/sfx/event_mapper/combat/mod.rs | 2 ++ .../audio/sfx/event_mapper/movement/mod.rs | 2 ++ .../audio/sfx/event_mapper/progression/mod.rs | 2 ++ voxygen/src/audio/sfx/mod.rs | 1 + voxygen/src/audio/soundcache.rs | 2 +- voxygen/src/ecs/sys/floater.rs | 3 ++ voxygen/src/ecs/sys/interpolation.rs | 2 ++ voxygen/src/error.rs | 1 - voxygen/src/hud/bag.rs | 3 ++ voxygen/src/hud/buttons.rs | 2 ++ voxygen/src/hud/chat.rs | 4 +++ voxygen/src/hud/esc_menu.rs | 1 + voxygen/src/hud/item_imgs.rs | 1 + voxygen/src/hud/map.rs | 3 ++ voxygen/src/hud/minimap.rs | 1 + voxygen/src/hud/mod.rs | 5 ++++ voxygen/src/hud/overhead.rs | 2 ++ voxygen/src/hud/popup.rs | 2 ++ voxygen/src/hud/settings_window.rs | 1 + voxygen/src/hud/skillbar.rs | 2 ++ voxygen/src/hud/social.rs | 1 + voxygen/src/hud/spell.rs | 1 + voxygen/src/i18n.rs | 1 + voxygen/src/key_state.rs | 1 + voxygen/src/logging.rs | 1 + voxygen/src/main.rs | 1 + voxygen/src/menu/char_selection/mod.rs | 1 + voxygen/src/menu/char_selection/ui.rs | 6 ++++ voxygen/src/menu/main/client_init.rs | 3 ++ voxygen/src/menu/main/mod.rs | 2 ++ voxygen/src/menu/main/ui.rs | 4 +++ voxygen/src/mesh/segment.rs | 4 +++ voxygen/src/mesh/terrain.rs | 7 +++++ voxygen/src/render/consts.rs | 1 + voxygen/src/render/error.rs | 1 + voxygen/src/render/instances.rs | 2 ++ voxygen/src/render/mesh.rs | 1 + voxygen/src/render/mod.rs | 3 +- voxygen/src/render/model.rs | 2 ++ voxygen/src/render/pipelines/figure.rs | 1 + voxygen/src/render/pipelines/fluid.rs | 2 ++ voxygen/src/render/pipelines/mod.rs | 2 ++ voxygen/src/render/pipelines/sprite.rs | 1 + voxygen/src/render/pipelines/terrain.rs | 1 + voxygen/src/render/pipelines/ui.rs | 1 + voxygen/src/render/renderer.rs | 3 ++ voxygen/src/render/texture.rs | 2 ++ voxygen/src/scene/figure/cache.rs | 3 ++ voxygen/src/scene/figure/mod.rs | 8 +++++ voxygen/src/scene/terrain.rs | 5 ++++ voxygen/src/settings.rs | 3 ++ voxygen/src/ui/event.rs | 1 + voxygen/src/ui/fonts.rs | 1 + voxygen/src/ui/graphic/pixel_art.rs | 1 + voxygen/src/ui/graphic/renderer.rs | 1 + voxygen/src/ui/mod.rs | 2 ++ voxygen/src/ui/widgets/ghost_image.rs | 1 + voxygen/src/ui/widgets/image_frame.rs | 1 + voxygen/src/ui/widgets/image_slider.rs | 1 + voxygen/src/ui/widgets/ingame.rs | 1 + voxygen/src/ui/widgets/radio_list.rs | 2 ++ voxygen/src/ui/widgets/slot.rs | 2 ++ voxygen/src/ui/widgets/toggle_button.rs | 1 + voxygen/src/ui/widgets/tooltip.rs | 2 ++ voxygen/src/window.rs | 2 ++ voxygen/tests/check_i18n_files.rs | 4 +++ world/examples/settlement_viewer.rs | 1 + world/examples/water.rs | 3 ++ world/src/block/mod.rs | 7 +++++ world/src/civ/mod.rs | 8 +++++ world/src/column/mod.rs | 8 +++++ world/src/lib.rs | 2 ++ world/src/sim/diffusion.rs | 3 ++ world/src/sim/erosion.rs | 16 ++++++++++ world/src/sim/map.rs | 3 ++ world/src/sim/mod.rs | 12 ++++++++ world/src/sim/util.rs | 1 + world/src/site/dungeon/mod.rs | 4 +++ .../settlement/building/archetype/house.rs | 2 ++ .../settlement/building/archetype/keep.rs | 1 + .../src/site/settlement/building/skeleton.rs | 2 ++ world/src/site/settlement/mod.rs | 9 ++++++ world/src/util/fast_noise.rs | 1 + world/src/util/small_cache.rs | 1 + world/src/util/structure.rs | 2 ++ 161 files changed, 375 insertions(+), 7 deletions(-) diff --git a/.gitlab/CI/check-compile.gitlab-ci.yml b/.gitlab/CI/check-compile.gitlab-ci.yml index 5bc50a24d5..5f5e673443 100644 --- a/.gitlab/CI/check-compile.gitlab-ci.yml +++ b/.gitlab/CI/check-compile.gitlab-ci.yml @@ -14,7 +14,7 @@ code-quality: - veloren-docker script: - ln -s /dockercache/cache-all target - - cargo clippy -- --warn clippy::all + - cargo clippy -- -D warnings - cargo fmt --all -- --check security: diff --git a/client/src/cmd.rs b/client/src/cmd.rs index 2fc1e68db7..5d8c8008db 100644 --- a/client/src/cmd.rs +++ b/client/src/cmd.rs @@ -78,6 +78,8 @@ fn nth_word(line: &str, n: usize) -> Option { None } +#[allow(clippy::chars_next_cmp)] // TODO: Pending review in #587 +#[allow(clippy::collapsible_if)] // TODO: Pending review in #587 pub fn complete(line: &str, client: &Client) -> Vec { let word = if line.chars().last().map_or(true, char::is_whitespace) { "" diff --git a/client/src/lib.rs b/client/src/lib.rs index 13e540d1c5..2498d49dc7 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -99,6 +99,8 @@ pub struct CharacterList { impl Client { /// Create a new `Client`. + #[allow(clippy::cmp_owned)] // TODO: Pending review in #587 + #[allow(clippy::or_fun_call)] // TODO: Pending review in #587 pub fn new>(addr: A, view_distance: Option) -> Result { let client_state = ClientState::Connected; let mut postbox = PostBox::to(addr)?; @@ -480,6 +482,7 @@ impl Client { /// Execute a single client tick, handle input and update the game state by /// the given duration. + #[allow(clippy::manual_saturating_arithmetic)] // TODO: Pending review in #587 pub fn tick( &mut self, inputs: ControllerInputs, @@ -699,6 +702,7 @@ impl Client { } /// Handle new server messages. + #[allow(clippy::collapsible_if)] // TODO: Pending review in #587 fn handle_new_messages(&mut self) -> Result, Error> { let mut frontend_events = Vec::new(); diff --git a/common/src/assets/mod.rs b/common/src/assets/mod.rs index 82263a2e2c..05ff190eb7 100644 --- a/common/src/assets/mod.rs +++ b/common/src/assets/mod.rs @@ -305,7 +305,7 @@ lazy_static! { } if let Ok(result) = std::env::var("XDG_DATA_DIRS") { - result.split(":").for_each(|x| paths.push(format!("{}/veloren/assets", x).into())); + result.split(':').for_each(|x| paths.push(format!("{}/veloren/assets", x).into())); } else { // Fallback let fallback_paths = vec!["/usr/local/share", "/usr/share"]; diff --git a/common/src/assets/watch.rs b/common/src/assets/watch.rs index 6d79340412..3fd652385e 100644 --- a/common/src/assets/watch.rs +++ b/common/src/assets/watch.rs @@ -104,6 +104,9 @@ impl Watcher { } } + #[allow(clippy::drop_copy)] // TODO: Pending review in #587 + #[allow(clippy::single_match)] // TODO: Pending review in #587 + #[allow(clippy::zero_ptr)] // TODO: Pending review in #587 fn run(mut self) -> Sender<(PathBuf, Handler, Weak)> { let (watch_tx, watch_rx) = unbounded(); @@ -136,6 +139,7 @@ pub struct ReloadIndicator { paths: Vec, } impl ReloadIndicator { + #[allow(clippy::new_without_default)] // TODO: Pending review in #587 pub fn new() -> Self { Self { reloaded: Arc::new(AtomicBool::new(false)), diff --git a/common/src/comp/inventory/mod.rs b/common/src/comp/inventory/mod.rs index b8767db06e..a74992592b 100644 --- a/common/src/comp/inventory/mod.rs +++ b/common/src/comp/inventory/mod.rs @@ -24,6 +24,7 @@ pub enum Error { Full(Vec), } +#[allow(clippy::len_without_is_empty)] // TODO: Pending review in #587 impl Inventory { pub fn slots(&self) -> &[Option] { &self.slots } @@ -180,6 +181,7 @@ impl Inventory { /// the proper structure wouldn't need to iterate at all, but because /// this should be fairly cold code, clarity has been favored over /// efficiency. + #[allow(clippy::option_map_unit_fn)] // TODO: Pending review in #587 pub fn push_all_unique>(&mut self, mut items: I) -> Result<(), Error> { let mut leftovers = Vec::new(); for item in &mut items { diff --git a/common/src/comp/inventory/slot.rs b/common/src/comp/inventory/slot.rs index 3495596774..b6e94543e0 100644 --- a/common/src/comp/inventory/slot.rs +++ b/common/src/comp/inventory/slot.rs @@ -139,6 +139,7 @@ pub fn loadout_remove(equip_slot: EquipSlot, loadout: &mut Loadout) -> Option }, } +#[allow(clippy::large_enum_variant)] // TODO: Pending review in #587 pub enum ServerEvent { Explosion { pos: Vec3, diff --git a/common/src/figure/mod.rs b/common/src/figure/mod.rs index 876a2c7453..aff29b0b06 100644 --- a/common/src/figure/mod.rs +++ b/common/src/figure/mod.rs @@ -73,6 +73,7 @@ impl Segment { pub struct DynaUnionizer(Vec<(Dyna, Vec3)>); impl DynaUnionizer { + #[allow(clippy::new_without_default)] // TODO: Pending review in #587 pub fn new() -> Self { DynaUnionizer(Vec::new()) } pub fn add(mut self, dyna: Dyna, offset: Vec3) -> Self { @@ -87,6 +88,7 @@ impl DynaUnionizer { } } + #[allow(clippy::neg_multiply)] // TODO: Pending review in #587 pub fn unify(self) -> (Dyna, Vec3) { if self.0.is_empty() { return (Dyna::filled(Vec3::zero(), V::empty(), ()), Vec3::zero()); diff --git a/common/src/loadout_builder.rs b/common/src/loadout_builder.rs index d2ddc35577..179a73df34 100644 --- a/common/src/loadout_builder.rs +++ b/common/src/loadout_builder.rs @@ -24,6 +24,7 @@ use crate::{ pub struct LoadoutBuilder(Loadout); impl LoadoutBuilder { + #[allow(clippy::new_without_default)] // TODO: Pending review in #587 pub fn new() -> Self { Self(Loadout { active_item: None, diff --git a/common/src/msg/ecs_packet.rs b/common/src/msg/ecs_packet.rs index 83ad59777f..998e607a91 100644 --- a/common/src/msg/ecs_packet.rs +++ b/common/src/msg/ecs_packet.rs @@ -6,6 +6,7 @@ use sum_type::sum_type; // Automatically derive From for EcsCompPacket // for each variant EcsCompPacket::T(T.) sum_type! { + #[allow(clippy::large_enum_variant)] // TODO: Pending review in #587 #[derive(Clone, Debug, Serialize, Deserialize)] pub enum EcsCompPacket { Body(comp::Body), diff --git a/common/src/path.rs b/common/src/path.rs index 156565cb64..0a81a95708 100644 --- a/common/src/path.rs +++ b/common/src/path.rs @@ -31,6 +31,7 @@ impl FromIterator for Path { } } +#[allow(clippy::len_without_is_empty)] // TODO: Pending review in #587 impl Path { pub fn len(&self) -> usize { self.nodes.len() } @@ -151,6 +152,7 @@ impl Chaser { } } +#[allow(clippy::float_cmp)] // TODO: Pending review in #587 fn find_path( astar: &mut Option, DefaultHashBuilder>>, vol: &V, diff --git a/common/src/region.rs b/common/src/region.rs index 4b814b54ea..7565fc4dda 100644 --- a/common/src/region.rs +++ b/common/src/region.rs @@ -89,6 +89,7 @@ pub struct RegionMap { tick: u64, } impl RegionMap { + #[allow(clippy::new_without_default)] // TODO: Pending review in #587 pub fn new() -> Self { Self { regions: IndexMap::default(), @@ -222,6 +223,7 @@ impl RegionMap { /// Finds the region where a given entity is located using a given position /// to speed up the search + #[allow(clippy::needless_range_loop)] // TODO: Pending review in #587 pub fn find_region(&self, entity: specs::Entity, pos: Vec3) -> Option> { let id = entity.id(); // Compute key for most likely region @@ -306,6 +308,7 @@ impl RegionMap { } /// Add a region using its key + #[allow(clippy::needless_range_loop)] // TODO: Pending review in #587 fn remove_index(&mut self, index: usize) { // Remap neighbor indices for neighbors of the region that will be moved from // the end of the index map diff --git a/common/src/spiral.rs b/common/src/spiral.rs index f0044763ca..34b454cd7a 100644 --- a/common/src/spiral.rs +++ b/common/src/spiral.rs @@ -9,12 +9,15 @@ pub struct Spiral2d { } impl Spiral2d { + #[allow(clippy::new_without_default)] // TODO: Pending review in #587 pub fn new() -> Self { Self { layer: 0, i: 0 } } } impl Iterator for Spiral2d { type Item = Vec2; + #[allow(clippy::erasing_op)] // TODO: Pending review in #587 + #[allow(clippy::identity_op)] // TODO: Pending review in #587 fn next(&mut self) -> Option { let layer_size = (self.layer * 8 + 4 * self.layer.min(1) - 4).max(1); if self.i >= layer_size { diff --git a/common/src/states/triple_strike.rs b/common/src/states/triple_strike.rs index 924d8b0b1a..2ac16f678e 100644 --- a/common/src/states/triple_strike.rs +++ b/common/src/states/triple_strike.rs @@ -69,6 +69,7 @@ impl CharacterBehavior for Data { fn behavior(&self, data: &JoinData) -> StateUpdate { let mut update = StateUpdate::from(data); + #[allow(clippy::or_fun_call)] // TODO: Pending review in #587 let stage_time_active = self .stage_time_active .checked_add(Duration::from_secs_f32(data.dt.0)) diff --git a/common/src/states/utils.rs b/common/src/states/utils.rs index 4efb8eb8e8..740c59c0ad 100644 --- a/common/src/states/utils.rs +++ b/common/src/states/utils.rs @@ -40,6 +40,7 @@ pub fn handle_move(data: &JoinData, update: &mut StateUpdate, efficiency: f32) { } /// Updates components to move player as if theyre on ground or in air +#[allow(clippy::assign_op_pattern)] // TODO: Pending review in #587 fn basic_move(data: &JoinData, update: &mut StateUpdate, efficiency: f32) { let (accel, speed): (f32, f32) = if data.physics.on_ground { (BASE_HUMANOID_ACCEL, BASE_HUMANOID_SPEED) diff --git a/common/src/sync/packet.rs b/common/src/sync/packet.rs index 2ab52b53bf..37e47ae30b 100644 --- a/common/src/sync/packet.rs +++ b/common/src/sync/packet.rs @@ -116,6 +116,7 @@ pub struct CompSyncPackage { } impl CompSyncPackage

{ + #[allow(clippy::new_without_default)] // TODO: Pending review in #587 pub fn new() -> Self { Self { comp_updates: Vec::new(), diff --git a/common/src/sys/agent.rs b/common/src/sys/agent.rs index f2aa4891f7..c482fd3eb0 100644 --- a/common/src/sys/agent.rs +++ b/common/src/sys/agent.rs @@ -23,6 +23,7 @@ use vek::*; /// This system will allow NPCs to modify their controller pub struct Sys; impl<'a> System<'a> for Sys { + #[allow(clippy::type_complexity)] type SystemData = ( Read<'a, UidAllocator>, Read<'a, Time>, @@ -42,6 +43,7 @@ impl<'a> System<'a> for Sys { ReadStorage<'a, MountState>, ); + #[allow(clippy::or_fun_call)] // TODO: Pending review in #587 fn run( &mut self, ( diff --git a/common/src/sys/character_behavior.rs b/common/src/sys/character_behavior.rs index befb31ec8b..98fe902c1f 100644 --- a/common/src/sys/character_behavior.rs +++ b/common/src/sys/character_behavior.rs @@ -109,6 +109,7 @@ impl<'a> JoinData<'a> { pub struct Sys; impl<'a> System<'a> for Sys { + #[allow(clippy::type_complexity)] type SystemData = ( Entities<'a>, Read<'a, UidAllocator>, @@ -131,6 +132,7 @@ impl<'a> System<'a> for Sys { ReadStorage<'a, Mounting>, ); + #[allow(clippy::while_let_on_iterator)] // TODO: Pending review in #587 fn run( &mut self, ( diff --git a/common/src/sys/combat.rs b/common/src/sys/combat.rs index b650692f31..ee7ac80143 100644 --- a/common/src/sys/combat.rs +++ b/common/src/sys/combat.rs @@ -16,6 +16,7 @@ pub const BLOCK_ANGLE: f32 = 180.0; /// attacking pub struct Sys; impl<'a> System<'a> for Sys { + #[allow(clippy::type_complexity)] type SystemData = ( Entities<'a>, Read<'a, EventBus>, diff --git a/common/src/sys/controller.rs b/common/src/sys/controller.rs index 12c5ed8444..f4330924b7 100644 --- a/common/src/sys/controller.rs +++ b/common/src/sys/controller.rs @@ -15,6 +15,7 @@ use specs::{ pub struct Sys; impl<'a> System<'a> for Sys { + #[allow(clippy::type_complexity)] type SystemData = ( Entities<'a>, Read<'a, UidAllocator>, diff --git a/common/src/sys/mount.rs b/common/src/sys/mount.rs index 54914a014a..864a2593d7 100644 --- a/common/src/sys/mount.rs +++ b/common/src/sys/mount.rs @@ -11,6 +11,7 @@ use vek::*; /// This system is responsible for controlling mounts pub struct Sys; impl<'a> System<'a> for Sys { + #[allow(clippy::type_complexity)] type SystemData = ( Read<'a, UidAllocator>, Entities<'a>, @@ -22,6 +23,7 @@ impl<'a> System<'a> for Sys { WriteStorage<'a, Ori>, ); + #[allow(clippy::option_map_unit_fn)] // TODO: Pending review in #587 fn run( &mut self, ( diff --git a/common/src/sys/phys.rs b/common/src/sys/phys.rs index ca4115e9a2..acf62170d5 100644 --- a/common/src/sys/phys.rs +++ b/common/src/sys/phys.rs @@ -38,6 +38,7 @@ fn integrate_forces(dt: f32, mut lv: Vec3, grav: f32, damp: f32) -> Vec3 System<'a> for Sys { + #[allow(clippy::type_complexity)] type SystemData = ( Entities<'a>, ReadStorage<'a, Uid>, @@ -56,6 +57,8 @@ impl<'a> System<'a> for Sys { ReadStorage<'a, Mounting>, ); + #[allow(clippy::or_fun_call)] // TODO: Pending review in #587 + #[allow(clippy::block_in_if_condition_stmt)] // TODO: Pending review in #587 fn run( &mut self, ( diff --git a/common/src/sys/projectile.rs b/common/src/sys/projectile.rs index c9471eeebf..7faf63b9a3 100644 --- a/common/src/sys/projectile.rs +++ b/common/src/sys/projectile.rs @@ -14,6 +14,7 @@ use vek::*; /// This system is responsible for handling projectile effect triggers pub struct Sys; impl<'a> System<'a> for Sys { + #[allow(clippy::type_complexity)] type SystemData = ( Entities<'a>, Read<'a, DeltaTime>, diff --git a/common/src/sys/stats.rs b/common/src/sys/stats.rs index aacf15e00a..266bda8158 100644 --- a/common/src/sys/stats.rs +++ b/common/src/sys/stats.rs @@ -10,6 +10,7 @@ const ENERGY_REGEN_ACCEL: f32 = 10.0; /// This system kills players, levels them up, and regenerates energy. pub struct Sys; impl<'a> System<'a> for Sys { + #[allow(clippy::type_complexity)] type SystemData = ( Entities<'a>, Read<'a, DeltaTime>, diff --git a/common/src/terrain/chonk.rs b/common/src/terrain/chonk.rs index 4c1daeaf08..0394184bde 100644 --- a/common/src/terrain/chonk.rs +++ b/common/src/terrain/chonk.rs @@ -167,6 +167,7 @@ impl Iterator for ChonkIterHelper { } } +#[allow(clippy::type_complexity)] // TODO: Pending review in #587 pub struct ChonkPosIter { outer: ChonkIterHelper, opt_inner: Option<(i32, ChunkPosIter, M>)>, diff --git a/common/src/util/color.rs b/common/src/util/color.rs index 907144828f..72a2eca0f2 100644 --- a/common/src/util/color.rs +++ b/common/src/util/color.rs @@ -40,6 +40,7 @@ pub fn linear_to_srgba(col: Rgba) -> Rgba { /// Convert rgb to hsv. Expects rgb to be [0, 1]. #[inline(always)] #[allow(clippy::many_single_char_names)] +#[allow(clippy::float_cmp)] // TODO: Pending review in #587 pub fn rgb_to_hsv(rgb: Rgb) -> Vec3 { let (r, g, b) = rgb.into_tuple(); let (max, min, diff, add) = { diff --git a/common/src/util/mod.rs b/common/src/util/mod.rs index 4dbe8eb127..21fe9a89ac 100644 --- a/common/src/util/mod.rs +++ b/common/src/util/mod.rs @@ -4,7 +4,7 @@ mod dir; pub const GIT_VERSION: &str = include_str!(concat!(env!("OUT_DIR"), "/githash")); lazy_static::lazy_static! { - pub static ref GIT_HASH: &'static str = GIT_VERSION.split('/').nth(0).expect("failed to retrieve git_hash!"); + pub static ref GIT_HASH: &'static str = GIT_VERSION.split('/').next().expect("failed to retrieve git_hash!"); pub static ref GIT_DATE: &'static str = GIT_VERSION.split('/').nth(1).expect("failed to retrieve git_date!"); } diff --git a/common/src/vol.rs b/common/src/vol.rs index 45edcfb905..2fc3fb54cc 100644 --- a/common/src/vol.rs +++ b/common/src/vol.rs @@ -97,6 +97,7 @@ pub trait ReadVol: BaseVol { /// Get a reference to the voxel at the provided position in the volume. fn get<'a>(&'a self, pos: Vec3) -> Result<&'a Self::Vox, Self::Error>; + #[allow(clippy::type_complexity)] // TODO: Pending review in #587 fn ray<'a>( &'a self, from: Vec3, diff --git a/common/src/volumes/chunk.rs b/common/src/volumes/chunk.rs index c0249fcaa2..233f3974da 100644 --- a/common/src/volumes/chunk.rs +++ b/common/src/volumes/chunk.rs @@ -208,6 +208,7 @@ impl ReadVol for Chunk { impl WriteVol for Chunk { #[inline(always)] + #[allow(clippy::unit_arg)] // TODO: Pending review in #587 fn set(&mut self, pos: Vec3, vox: Self::Vox) -> Result<(), Self::Error> { if !pos .map2(S::SIZE, |e, s| 0 <= e && e < s as i32) diff --git a/common/src/volumes/vol_grid_2d.rs b/common/src/volumes/vol_grid_2d.rs index 561ae7b52f..4808c94942 100644 --- a/common/src/volumes/vol_grid_2d.rs +++ b/common/src/volumes/vol_grid_2d.rs @@ -148,6 +148,7 @@ impl VolGrid2d { } } + #[allow(clippy::needless_lifetimes)] // TODO: Pending review in #587 pub fn cached<'a>(&'a self) -> CachedVolGrid2d<'a, V> { CachedVolGrid2d::new(self) } } diff --git a/server-cli/src/main.rs b/server-cli/src/main.rs index 0702f341e1..00dd2e1d67 100644 --- a/server-cli/src/main.rs +++ b/server-cli/src/main.rs @@ -7,6 +7,7 @@ use std::time::Duration; const TPS: u64 = 30; +#[allow(clippy::redundant_pattern_matching)] // TODO: Pending review in #587 fn main() { // Init logging if let Err(_) = std::env::var("RUST_LOG") { diff --git a/server/src/chunk_generator.rs b/server/src/chunk_generator.rs index cee288ebe2..3e769956da 100644 --- a/server/src/chunk_generator.rs +++ b/server/src/chunk_generator.rs @@ -22,6 +22,7 @@ pub struct ChunkGenerator { pending_chunks: HashMap, Arc>, } impl ChunkGenerator { + #[allow(clippy::new_without_default)] // TODO: Pending review in #587 pub fn new() -> Self { let (chunk_tx, chunk_rx) = channel::unbounded(); Self { diff --git a/server/src/cmd.rs b/server/src/cmd.rs index 0e380369ab..2e4187ad33 100644 --- a/server/src/cmd.rs +++ b/server/src/cmd.rs @@ -29,6 +29,7 @@ pub trait ChatCommandExt { fn execute(&self, server: &mut Server, entity: EcsEntity, args: String); } impl ChatCommandExt for ChatCommand { + #[allow(clippy::needless_return)] // TODO: Pending review in #587 fn execute(&self, server: &mut Server, entity: EcsEntity, args: String) { let cmd_data = self.data(); if cmd_data.needs_admin && !server.entity_is_admin(entity) { @@ -91,6 +92,8 @@ fn get_handler(cmd: &ChatCommand) -> CommandHandler { } } +#[allow(clippy::identity_conversion)] // TODO: Pending review in #587 +#[allow(clippy::option_map_unit_fn)] // TODO: Pending review in #587 fn handle_give_item( server: &mut Server, client: EcsEntity, @@ -189,6 +192,7 @@ fn handle_jump( } } +#[allow(clippy::identity_conversion)] // TODO: Pending review in #587 fn handle_goto( server: &mut Server, client: EcsEntity, @@ -220,6 +224,8 @@ fn handle_goto( } } +#[allow(clippy::collapsible_if)] // TODO: Pending review in #587 +#[allow(clippy::option_map_unit_fn)] // TODO: Pending review in #587 fn handle_kill( server: &mut Server, client: EcsEntity, @@ -244,6 +250,7 @@ fn handle_kill( .map(|s| s.health.set_to(0, reason)); } +#[allow(clippy::option_as_ref_deref)] // TODO: Pending review in #587 fn handle_time( server: &mut Server, client: EcsEntity, @@ -331,6 +338,7 @@ fn handle_health( } } +#[allow(clippy::identity_conversion)] // TODO: Pending review in #587 fn handle_alias( server: &mut Server, client: EcsEntity, @@ -377,6 +385,9 @@ fn handle_alias( } } +#[allow(clippy::collapsible_if)] // TODO: Pending review in #587 +#[allow(clippy::identity_conversion)] // TODO: Pending review in #587 +#[allow(clippy::useless_format)] // TODO: Pending review in #587 fn handle_tp( server: &mut Server, client: EcsEntity, @@ -428,6 +439,8 @@ fn handle_tp( } } +#[allow(clippy::identity_conversion)] // TODO: Pending review in #587 +#[allow(clippy::redundant_clone)] // TODO: Pending review in #587 fn handle_spawn( server: &mut Server, client: EcsEntity, @@ -573,6 +586,7 @@ fn handle_build( } } +#[allow(clippy::identity_conversion)] // TODO: Pending review in #587 fn handle_help( server: &mut Server, client: EcsEntity, @@ -624,6 +638,9 @@ fn handle_kill_npcs( server.notify_client(client, ServerMsg::private(text)); } +#[allow(clippy::float_cmp)] // TODO: Pending review in #587 +#[allow(clippy::needless_return)] // TODO: Pending review in #587 +#[allow(clippy::useless_format)] // TODO: Pending review in #587 fn handle_object( server: &mut Server, client: EcsEntity, @@ -688,6 +705,7 @@ fn handle_object( } } +#[allow(clippy::useless_format)] // TODO: Pending review in #587 fn handle_light( server: &mut Server, client: EcsEntity, @@ -750,6 +768,7 @@ fn handle_light( } } +#[allow(clippy::identity_conversion)] // TODO: Pending review in #587 fn handle_lantern( server: &mut Server, client: EcsEntity, @@ -862,6 +881,7 @@ fn handle_waypoint( } } +#[allow(clippy::identity_conversion)] // TODO: Pending review in #587 fn handle_adminify( server: &mut Server, client: EcsEntity, @@ -903,6 +923,8 @@ fn handle_adminify( } } +#[allow(clippy::identity_conversion)] // TODO: Pending review in #587 +#[allow(clippy::useless_format)] // TODO: Pending review in #587 fn handle_tell( server: &mut Server, client: EcsEntity, @@ -987,6 +1009,8 @@ fn handle_debug_column( } #[cfg(feature = "worldgen")] +#[allow(clippy::blacklisted_name)] // TODO: Pending review in #587 +#[allow(clippy::identity_conversion)] // TODO: Pending review in #587 fn handle_debug_column( server: &mut Server, client: EcsEntity, @@ -1067,6 +1091,7 @@ spawn_rate {:?} "#, } } +#[allow(clippy::or_fun_call)] // TODO: Pending review in #587 fn find_target( ecs: &specs::World, opt_alias: Option, @@ -1207,6 +1232,7 @@ fn handle_debug( } } +#[allow(clippy::identity_conversion)] // TODO: Pending review in #587 fn handle_remove_lights( server: &mut Server, client: EcsEntity, @@ -1258,6 +1284,10 @@ fn handle_remove_lights( ); } +#[allow(clippy::chars_next_cmp)] // TODO: Pending review in #587 +#[allow(clippy::identity_conversion)] // TODO: Pending review in #587 +#[allow(clippy::or_fun_call)] // TODO: Pending review in #587 +#[allow(clippy::useless_format)] // TODO: Pending review in #587 fn handle_sudo( server: &mut Server, client: EcsEntity, diff --git a/server/src/events/entity_creation.rs b/server/src/events/entity_creation.rs index 93a925ee1d..32e8a081a5 100644 --- a/server/src/events/entity_creation.rs +++ b/server/src/events/entity_creation.rs @@ -22,6 +22,7 @@ pub fn handle_create_character( sys::subscription::initialize_region_subscription(state.ecs(), entity); } +#[allow(clippy::too_many_arguments)] // TODO: Pending review in #587 pub fn handle_create_npc( server: &mut Server, pos: Pos, diff --git a/server/src/events/entity_manipulation.rs b/server/src/events/entity_manipulation.rs index d5a4336e24..3f7124220c 100644 --- a/server/src/events/entity_manipulation.rs +++ b/server/src/events/entity_manipulation.rs @@ -24,6 +24,8 @@ pub fn handle_damage(server: &Server, uid: Uid, change: HealthChange) { } } +#[allow(clippy::collapsible_if)] // TODO: Pending review in #587 +#[allow(clippy::option_map_unit_fn)] // TODO: Pending review in #587 pub fn handle_destroy(server: &mut Server, entity: EcsEntity, cause: HealthSource) { let state = server.state_mut(); @@ -333,6 +335,7 @@ pub fn handle_land_on_ground(server: &Server, entity: EcsEntity, vel: Vec3) } } +#[allow(clippy::option_map_unit_fn)] // TODO: Pending review in #587 pub fn handle_respawn(server: &Server, entity: EcsEntity) { let state = &server.state; diff --git a/server/src/events/interaction.rs b/server/src/events/interaction.rs index df6cf3ab35..45ccbd43b0 100644 --- a/server/src/events/interaction.rs +++ b/server/src/events/interaction.rs @@ -48,6 +48,7 @@ pub fn handle_lantern(server: &mut Server, entity: EcsEntity) { } } +#[allow(clippy::identity_conversion)] // TODO: Pending review in #587 pub fn handle_mount(server: &mut Server, mounter: EcsEntity, mountee: EcsEntity) { let state = server.state_mut(); @@ -80,6 +81,7 @@ pub fn handle_mount(server: &mut Server, mounter: EcsEntity, mountee: EcsEntity) } } +#[allow(clippy::option_map_unit_fn)] // TODO: Pending review in #587 pub fn handle_unmount(server: &mut Server, mounter: EcsEntity) { let state = server.state_mut(); let mountee_entity = state @@ -97,6 +99,8 @@ pub fn handle_unmount(server: &mut Server, mounter: EcsEntity) { state.delete_component::(mounter); } +#[allow(clippy::nonminimal_bool)] // TODO: Pending review in #587 +#[allow(clippy::option_map_unit_fn)] // TODO: Pending review in #587 pub fn handle_possess(server: &Server, possessor_uid: Uid, possesse_uid: Uid) { let state = &server.state; let ecs = state.ecs(); diff --git a/server/src/events/inventory_manip.rs b/server/src/events/inventory_manip.rs index 0333cff3e9..e79b2645d6 100644 --- a/server/src/events/inventory_manip.rs +++ b/server/src/events/inventory_manip.rs @@ -29,6 +29,9 @@ pub fn snuff_lantern(storage: &mut WriteStorage, entity: Ecs storage.remove(entity); } +#[allow(clippy::block_in_if_condition_stmt)] // TODO: Pending review in #587 +#[allow(clippy::collapsible_if)] // TODO: Pending review in #587 +#[allow(clippy::let_and_return)] // TODO: Pending review in #587 pub fn handle_inventory(server: &mut Server, entity: EcsEntity, manip: comp::InventoryManip) { let state = server.state_mut(); let mut dropped_items = Vec::new(); diff --git a/server/src/lib.rs b/server/src/lib.rs index bbcd8ec84d..8f712db850 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -87,6 +87,8 @@ pub struct Server { impl Server { /// Create a new `Server` + #[allow(clippy::expect_fun_call)] // TODO: Pending review in #587 + #[allow(clippy::needless_update)] // TODO: Pending review in #587 pub fn new(settings: ServerSettings) -> Result { let mut state = State::default(); state.ecs_mut().insert(EventBus::::default()); diff --git a/server/src/metrics.rs b/server/src/metrics.rs index 0c13a98c8c..56d707d8ce 100644 --- a/server/src/metrics.rs +++ b/server/src/metrics.rs @@ -34,6 +34,7 @@ pub struct ServerMetrics { } impl TickMetrics { + #[allow(clippy::identity_conversion)] // TODO: Pending review in #587 pub fn new(registry: &Registry, tick: Arc) -> Result> { let player_online = IntGauge::with_opts(Opts::new( "player_online", @@ -102,6 +103,7 @@ impl TickMetrics { } impl ServerMetrics { + #[allow(clippy::new_without_default)] // TODO: Pending review in #587 pub fn new() -> Self { let running = Arc::new(AtomicBool::new(false)); let tick = Arc::new(AtomicU64::new(0)); diff --git a/server/src/persistence/character.rs b/server/src/persistence/character.rs index 5d1ba89ae1..e120aaf53b 100644 --- a/server/src/persistence/character.rs +++ b/server/src/persistence/character.rs @@ -23,6 +23,7 @@ type CharacterListResult = Result, Error>; /// /// After first logging in, and after a character is selected, we fetch this /// data for the purpose of inserting their persisted data for the entity. +#[allow(clippy::redundant_closure)] // TODO: Pending review in #587 pub fn load_character_data( character_id: i32, db_dir: &str, @@ -101,6 +102,7 @@ pub fn load_character_data( /// In the event that a join fails, for a character (i.e. they lack an entry for /// stats, body, etc...) the character is skipped, and no entry will be /// returned. +#[allow(clippy::redundant_closure)] // TODO: Pending review in #587 pub fn load_character_list(player_uuid: &str, db_dir: &str) -> CharacterListResult { let data = schema::character::dsl::character .filter(schema::character::player_uuid.eq(player_uuid)) diff --git a/server/src/persistence/mod.rs b/server/src/persistence/mod.rs index a47d253492..e3e788b72e 100644 --- a/server/src/persistence/mod.rs +++ b/server/src/persistence/mod.rs @@ -46,6 +46,7 @@ fn establish_connection(db_dir: &str) -> SqliteConnection { connection } +#[allow(clippy::single_match)] // TODO: Pending review in #587 fn apply_saves_dir_override(db_dir: &str) -> String { if let Some(val) = env::var_os("VELOREN_SAVES_DIR") { let path = PathBuf::from(val); diff --git a/server/src/settings.rs b/server/src/settings.rs index ae811d59b4..3432482777 100644 --- a/server/src/settings.rs +++ b/server/src/settings.rs @@ -63,6 +63,7 @@ impl Default for ServerSettings { } impl ServerSettings { + #[allow(clippy::single_match)] // TODO: Pending review in #587 pub fn load() -> Self { let path = ServerSettings::get_settings_path(); diff --git a/server/src/state_ext.rs b/server/src/state_ext.rs index c231aae6d3..4a80c8bbab 100644 --- a/server/src/state_ext.rs +++ b/server/src/state_ext.rs @@ -65,6 +65,7 @@ impl StateExt for State { success } + #[allow(clippy::option_map_unit_fn)] // TODO: Pending review in #587 fn apply_effect(&mut self, entity: EcsEntity, effect: Effect) { match effect { Effect::Health(change) => { @@ -152,6 +153,7 @@ impl StateExt for State { .with(comp::Sticky) } + #[allow(clippy::unnecessary_operation)] // TODO: Pending review in #587 fn create_player_character( &mut self, entity: EcsEntity, diff --git a/server/src/sys/entity_sync.rs b/server/src/sys/entity_sync.rs index 619458d61c..8bb433b3a2 100644 --- a/server/src/sys/entity_sync.rs +++ b/server/src/sys/entity_sync.rs @@ -20,6 +20,7 @@ use specs::{ /// This system will send physics updates to the client pub struct Sys; impl<'a> System<'a> for Sys { + #[allow(clippy::type_complexity)] // TODO: Pending review in #587 type SystemData = ( Entities<'a>, Read<'a, Tick>, @@ -43,6 +44,7 @@ impl<'a> System<'a> for Sys { ReadTrackers<'a>, ); + #[allow(clippy::redundant_closure)] // TODO: Pending review in #587 fn run( &mut self, ( diff --git a/server/src/sys/message.rs b/server/src/sys/message.rs index f990979bf2..2e9ec79338 100644 --- a/server/src/sys/message.rs +++ b/server/src/sys/message.rs @@ -26,6 +26,7 @@ use specs::{ /// This system will handle new messages from clients pub struct Sys; impl<'a> System<'a> for Sys { + #[allow(clippy::type_complexity)] // TODO: Pending review in #587 type SystemData = ( Entities<'a>, Read<'a, EventBus>, @@ -49,6 +50,10 @@ impl<'a> System<'a> for Sys { WriteStorage<'a, SpeechBubble>, ); + #[allow(clippy::match_ref_pats)] // TODO: Pending review in #587 + #[allow(clippy::option_map_unit_fn)] // TODO: Pending review in #587 + #[allow(clippy::single_char_pattern)] // TODO: Pending review in #587 + #[allow(clippy::single_match)] // TODO: Pending review in #587 fn run( &mut self, ( diff --git a/server/src/sys/persistence.rs b/server/src/sys/persistence.rs index a5d8137d66..bc6d8fc493 100644 --- a/server/src/sys/persistence.rs +++ b/server/src/sys/persistence.rs @@ -8,6 +8,7 @@ use specs::{Join, ReadExpect, ReadStorage, System, Write}; pub struct Sys; impl<'a> System<'a> for Sys { + #[allow(clippy::type_complexity)] // TODO: Pending review in #587 type SystemData = ( ReadStorage<'a, Player>, ReadStorage<'a, Stats>, diff --git a/server/src/sys/sentinel.rs b/server/src/sys/sentinel.rs index 27acbd7a0f..5ec309e46c 100644 --- a/server/src/sys/sentinel.rs +++ b/server/src/sys/sentinel.rs @@ -57,6 +57,7 @@ pub struct TrackedComps<'a> { pub speech_bubble: ReadStorage<'a, SpeechBubble>, } impl<'a> TrackedComps<'a> { + #[allow(clippy::option_map_unit_fn)] // TODO: Pending review in #587 pub fn create_entity_package( &self, entity: EcsEntity, diff --git a/server/src/sys/subscription.rs b/server/src/sys/subscription.rs index 36a2a64b9c..0d37a2c233 100644 --- a/server/src/sys/subscription.rs +++ b/server/src/sys/subscription.rs @@ -21,6 +21,7 @@ use vek::*; /// This system will update region subscriptions based on client positions pub struct Sys; impl<'a> System<'a> for Sys { + #[allow(clippy::type_complexity)] // TODO: Pending review in #587 type SystemData = ( Entities<'a>, ReadExpect<'a, RegionMap>, @@ -36,6 +37,8 @@ impl<'a> System<'a> for Sys { TrackedComps<'a>, ); + #[allow(clippy::block_in_if_condition_stmt)] // TODO: Pending review in #587 + #[allow(clippy::clone_on_copy)] // TODO: Pending review in #587 fn run( &mut self, ( diff --git a/server/src/sys/terrain.rs b/server/src/sys/terrain.rs index e0bfc7d43b..9a5723601f 100644 --- a/server/src/sys/terrain.rs +++ b/server/src/sys/terrain.rs @@ -23,6 +23,7 @@ use vek::*; /// 4. Removes chunks outside the range of players pub struct Sys; impl<'a> System<'a> for Sys { + #[allow(clippy::type_complexity)] // TODO: Pending review in #587 type SystemData = ( Read<'a, EventBus>, Read<'a, Tick>, @@ -35,6 +36,9 @@ impl<'a> System<'a> for Sys { WriteStorage<'a, Client>, ); + #[allow(clippy::identity_conversion)] // TODO: Pending review in #587 + #[allow(clippy::manual_saturating_arithmetic)] // TODO: Pending review in #587 + #[allow(clippy::or_fun_call)] // TODO: Pending review in #587 fn run( &mut self, ( @@ -394,6 +398,8 @@ impl<'a> System<'a> for Sys { } } +#[allow(clippy::identity_conversion)] // TODO: Pending review in #587 +#[allow(clippy::manual_saturating_arithmetic)] // TODO: Pending review in #587 pub fn chunk_in_vd( player_pos: Vec3, chunk_pos: Vec2, diff --git a/server/src/sys/terrain_sync.rs b/server/src/sys/terrain_sync.rs index 2300640120..a9899be209 100644 --- a/server/src/sys/terrain_sync.rs +++ b/server/src/sys/terrain_sync.rs @@ -12,6 +12,7 @@ use specs::{Join, Read, ReadExpect, ReadStorage, System, Write, WriteStorage}; /// chunks pub struct Sys; impl<'a> System<'a> for Sys { + #[allow(clippy::type_complexity)] // TODO: Pending review in #587 type SystemData = ( ReadExpect<'a, TerrainGrid>, Read<'a, TerrainChanges>, diff --git a/server/src/sys/waypoint.rs b/server/src/sys/waypoint.rs index 23810bd20f..c7b3ebbfb7 100644 --- a/server/src/sys/waypoint.rs +++ b/server/src/sys/waypoint.rs @@ -14,6 +14,7 @@ const NOTIFY_TIME: f64 = 10.0; /// TODO: Make this faster by only considering local waypoints pub struct Sys; impl<'a> System<'a> for Sys { + #[allow(clippy::type_complexity)] // TODO: Pending review in #587 type SystemData = ( Entities<'a>, ReadStorage<'a, Pos>, diff --git a/voxygen/benches/meshing_benchmark.rs b/voxygen/benches/meshing_benchmark.rs index 721d080512..45b7a39403 100644 --- a/voxygen/benches/meshing_benchmark.rs +++ b/voxygen/benches/meshing_benchmark.rs @@ -11,6 +11,7 @@ use world::{sim, World}; const CENTER: Vec2 = Vec2 { x: 512, y: 512 }; const GEN_SIZE: i32 = 4; +#[allow(clippy::needless_update)] // TODO: Pending review in #587 pub fn criterion_benchmark(c: &mut Criterion) { // Generate chunks here to test let mut terrain = TerrainGrid::new().unwrap(); diff --git a/voxygen/examples/character_renderer.rs b/voxygen/examples/character_renderer.rs index 72e26def69..3a70178704 100644 --- a/voxygen/examples/character_renderer.rs +++ b/voxygen/examples/character_renderer.rs @@ -3,6 +3,7 @@ use gfx_window_glutin::init_headless; use vek::*; use veloren_voxygen::{render, scene::simple as scene}; +#[allow(clippy::clone_on_copy)] // TODO: Pending review in #587 fn main() { // Setup renderer let dim = (200u16, 300u16, 1, gfx::texture::AaMode::Single); diff --git a/voxygen/src/anim/bird_small/mod.rs b/voxygen/src/anim/bird_small/mod.rs index 2bbf379cb2..61202ed213 100644 --- a/voxygen/src/anim/bird_small/mod.rs +++ b/voxygen/src/anim/bird_small/mod.rs @@ -19,6 +19,7 @@ pub struct BirdSmallSkeleton { } impl BirdSmallSkeleton { + #[allow(clippy::new_without_default)] // TODO: Pending review in #587 pub fn new() -> Self { Self { head: Bone::default(), diff --git a/voxygen/src/anim/character/alpha.rs b/voxygen/src/anim/character/alpha.rs index b4b241242c..be0b10846d 100644 --- a/voxygen/src/anim/character/alpha.rs +++ b/voxygen/src/anim/character/alpha.rs @@ -9,6 +9,7 @@ impl Animation for AlphaAnimation { type Dependency = (Option, f32, f64); type Skeleton = CharacterSkeleton; + #[allow(clippy::approx_constant)] // TODO: Pending review in #587 fn update_skeleton( skeleton: &Self::Skeleton, (active_tool_kind, velocity, _global_time): Self::Dependency, diff --git a/voxygen/src/anim/character/charge.rs b/voxygen/src/anim/character/charge.rs index b7d8d1fb34..be62c34405 100644 --- a/voxygen/src/anim/character/charge.rs +++ b/voxygen/src/anim/character/charge.rs @@ -9,6 +9,8 @@ impl Animation for ChargeAnimation { type Dependency = (Option, f32, Vec3, Vec3, f64); type Skeleton = CharacterSkeleton; + #[allow(clippy::approx_constant)] // TODO: Pending review in #587 + #[allow(clippy::identity_conversion)] // TODO: Pending review in #587 fn update_skeleton( skeleton: &Self::Skeleton, (active_tool_kind, velocity, orientation, last_ori, _global_time): Self::Dependency, diff --git a/voxygen/src/anim/character/dash.rs b/voxygen/src/anim/character/dash.rs index 2d4a4ab9f5..6bab9a07fd 100644 --- a/voxygen/src/anim/character/dash.rs +++ b/voxygen/src/anim/character/dash.rs @@ -11,6 +11,7 @@ impl Animation for DashAnimation { type Dependency = (Option, f64); type Skeleton = CharacterSkeleton; + #[allow(clippy::single_match)] // TODO: Pending review in #587 fn update_skeleton( skeleton: &Self::Skeleton, (active_tool_kind, _global_time): Self::Dependency, diff --git a/voxygen/src/anim/character/equip.rs b/voxygen/src/anim/character/equip.rs index da8b06d57c..a877968c11 100644 --- a/voxygen/src/anim/character/equip.rs +++ b/voxygen/src/anim/character/equip.rs @@ -10,6 +10,7 @@ impl Animation for EquipAnimation { type Dependency = (Option, f32, f64); type Skeleton = CharacterSkeleton; + #[allow(clippy::approx_constant)] // TODO: Pending review in #587 fn update_skeleton( skeleton: &Self::Skeleton, (active_tool_kind, velocity, global_time): Self::Dependency, diff --git a/voxygen/src/anim/character/gliding.rs b/voxygen/src/anim/character/gliding.rs index 15e3e39cd3..9bde7282bc 100644 --- a/voxygen/src/anim/character/gliding.rs +++ b/voxygen/src/anim/character/gliding.rs @@ -9,6 +9,7 @@ impl Animation for GlidingAnimation { type Dependency = (Option, Vec3, Vec3, Vec3, f64); type Skeleton = CharacterSkeleton; + #[allow(clippy::identity_conversion)] // TODO: Pending review in #587 fn update_skeleton( skeleton: &Self::Skeleton, (_active_tool_kind, velocity, orientation, last_ori, global_time): Self::Dependency, diff --git a/voxygen/src/anim/character/jump.rs b/voxygen/src/anim/character/jump.rs index c4a2b5dfc0..56b56a31f3 100644 --- a/voxygen/src/anim/character/jump.rs +++ b/voxygen/src/anim/character/jump.rs @@ -7,6 +7,7 @@ impl Animation for JumpAnimation { type Dependency = (Option, Vec3, Vec3, f64); type Skeleton = CharacterSkeleton; + #[allow(clippy::identity_conversion)] // TODO: Pending review in #587 fn update_skeleton( skeleton: &Self::Skeleton, (_active_tool_kind, orientation, last_ori, global_time): Self::Dependency, diff --git a/voxygen/src/anim/character/mod.rs b/voxygen/src/anim/character/mod.rs index 9f13a3e3f2..13e0278d23 100644 --- a/voxygen/src/anim/character/mod.rs +++ b/voxygen/src/anim/character/mod.rs @@ -202,6 +202,7 @@ impl SkeletonAttr { } impl<'a> From<&'a comp::humanoid::Body> for SkeletonAttr { + #[allow(clippy::match_single_binding)] // TODO: Pending review in #587 fn from(body: &'a comp::humanoid::Body) -> Self { use comp::humanoid::{BodyType::*, Species::*}; Self { diff --git a/voxygen/src/anim/character/roll.rs b/voxygen/src/anim/character/roll.rs index 932aa1d1bb..4813aaa4b4 100644 --- a/voxygen/src/anim/character/roll.rs +++ b/voxygen/src/anim/character/roll.rs @@ -8,6 +8,7 @@ impl Animation for RollAnimation { type Dependency = (Option, Vec3, Vec3, f64); type Skeleton = CharacterSkeleton; + #[allow(clippy::identity_conversion)] // TODO: Pending review in #587 fn update_skeleton( skeleton: &Self::Skeleton, (_active_tool_kind, orientation, last_ori, _global_time): Self::Dependency, diff --git a/voxygen/src/anim/character/run.rs b/voxygen/src/anim/character/run.rs index 42920e42aa..e15e2df631 100644 --- a/voxygen/src/anim/character/run.rs +++ b/voxygen/src/anim/character/run.rs @@ -9,6 +9,7 @@ impl Animation for RunAnimation { type Dependency = (Option, Vec3, Vec3, Vec3, f64); type Skeleton = CharacterSkeleton; + #[allow(clippy::identity_conversion)] // TODO: Pending review in #587 fn update_skeleton( skeleton: &Self::Skeleton, (_active_tool_kind, velocity, orientation, last_ori, global_time): Self::Dependency, diff --git a/voxygen/src/anim/character/shoot.rs b/voxygen/src/anim/character/shoot.rs index 65c12d99d1..e666afb348 100644 --- a/voxygen/src/anim/character/shoot.rs +++ b/voxygen/src/anim/character/shoot.rs @@ -8,6 +8,7 @@ impl Animation for ShootAnimation { type Dependency = (Option, f32, f64); type Skeleton = CharacterSkeleton; + #[allow(clippy::approx_constant)] // TODO: Pending review in #587 fn update_skeleton( skeleton: &Self::Skeleton, (active_tool_kind, velocity, _global_time): Self::Dependency, diff --git a/voxygen/src/anim/character/swim.rs b/voxygen/src/anim/character/swim.rs index 0113b92afa..b65a09fcfe 100644 --- a/voxygen/src/anim/character/swim.rs +++ b/voxygen/src/anim/character/swim.rs @@ -9,6 +9,7 @@ impl Animation for SwimAnimation { type Dependency = (Option, Vec3, Vec3, Vec3, f64); type Skeleton = CharacterSkeleton; + #[allow(clippy::identity_conversion)] // TODO: Pending review in #587 fn update_skeleton( skeleton: &Self::Skeleton, (_active_tool_kind, velocity, orientation, last_ori, global_time): Self::Dependency, diff --git a/voxygen/src/anim/character/wield.rs b/voxygen/src/anim/character/wield.rs index 9b5a6ba5e8..03e576fb4c 100644 --- a/voxygen/src/anim/character/wield.rs +++ b/voxygen/src/anim/character/wield.rs @@ -9,6 +9,7 @@ impl Animation for WieldAnimation { type Dependency = (Option, f32, f64); type Skeleton = CharacterSkeleton; + #[allow(clippy::approx_constant)] // TODO: Pending review in #587 fn update_skeleton( skeleton: &Self::Skeleton, (active_tool_kind, velocity, global_time): Self::Dependency, diff --git a/voxygen/src/anim/critter/mod.rs b/voxygen/src/anim/critter/mod.rs index 56d40c2cd2..85268c3f06 100644 --- a/voxygen/src/anim/critter/mod.rs +++ b/voxygen/src/anim/critter/mod.rs @@ -80,6 +80,7 @@ impl<'a> std::convert::TryFrom<&'a comp::Body> for CritterAttr { } impl CritterAttr { + #[allow(clippy::match_single_binding)] // TODO: Pending review in #587 pub fn calculate_scale(body: &comp::critter::Body) -> f32 { match (body.species, body.body_type) { (_, _) => 0.0, diff --git a/voxygen/src/anim/fish_medium/mod.rs b/voxygen/src/anim/fish_medium/mod.rs index 8853f40f57..4693f0fea9 100644 --- a/voxygen/src/anim/fish_medium/mod.rs +++ b/voxygen/src/anim/fish_medium/mod.rs @@ -21,6 +21,7 @@ pub struct FishMediumSkeleton { } impl FishMediumSkeleton { + #[allow(clippy::new_without_default)] // TODO: Pending review in #587 pub fn new() -> Self { Self { head: Bone::default(), diff --git a/voxygen/src/anim/fish_small/mod.rs b/voxygen/src/anim/fish_small/mod.rs index 0912647f5c..547e376ccf 100644 --- a/voxygen/src/anim/fish_small/mod.rs +++ b/voxygen/src/anim/fish_small/mod.rs @@ -17,6 +17,7 @@ pub struct FishSmallSkeleton { } impl FishSmallSkeleton { + #[allow(clippy::new_without_default)] // TODO: Pending review in #587 pub fn new() -> Self { Self { torso: Bone::default(), diff --git a/voxygen/src/anim/fixture/mod.rs b/voxygen/src/anim/fixture/mod.rs index ae34c70e01..89ddd153af 100644 --- a/voxygen/src/anim/fixture/mod.rs +++ b/voxygen/src/anim/fixture/mod.rs @@ -8,6 +8,7 @@ pub struct FixtureSkeleton; pub struct SkeletonAttr; impl FixtureSkeleton { + #[allow(clippy::new_without_default)] // TODO: Pending review in #587 pub fn new() -> Self { Self {} } } diff --git a/voxygen/src/anim/golem/mod.rs b/voxygen/src/anim/golem/mod.rs index fceda8c230..415b93f631 100644 --- a/voxygen/src/anim/golem/mod.rs +++ b/voxygen/src/anim/golem/mod.rs @@ -26,6 +26,7 @@ pub struct GolemSkeleton { } impl GolemSkeleton { + #[allow(clippy::new_without_default)] // TODO: Pending review in #587 pub fn new() -> Self { Self { head: Bone::default(), diff --git a/voxygen/src/anim/object/mod.rs b/voxygen/src/anim/object/mod.rs index 71dff4052d..ec84809741 100644 --- a/voxygen/src/anim/object/mod.rs +++ b/voxygen/src/anim/object/mod.rs @@ -7,6 +7,7 @@ pub struct ObjectSkeleton; pub struct SkeletonAttr; impl ObjectSkeleton { + #[allow(clippy::new_without_default)] // TODO: Pending review in #587 pub fn new() -> Self { Self {} } } diff --git a/voxygen/src/audio/fader.rs b/voxygen/src/audio/fader.rs index 1af58c8c20..a6f6cdad23 100644 --- a/voxygen/src/audio/fader.rs +++ b/voxygen/src/audio/fader.rs @@ -50,6 +50,7 @@ impl Fader { } } + #[allow(clippy::assign_op_pattern)] // TODO: Pending review in #587 pub fn update(&mut self, dt: f32) { if self.is_running { self.running_time = self.running_time + dt; @@ -103,6 +104,7 @@ mod tests { } #[test] + #[allow(clippy::float_cmp)] // TODO: Pending review in #587 fn fade_out_completes() { let mut fader = Fader::fade_out(10.0, 1.0); @@ -146,6 +148,7 @@ mod tests { } #[test] + #[allow(clippy::float_cmp)] // TODO: Pending review in #587 fn update_target_volume_fading_in_when_currently_above() { let mut fader = Fader::fade_in(10.0, 1.0); @@ -162,6 +165,7 @@ mod tests { } #[test] + #[allow(clippy::float_cmp)] // TODO: Pending review in #587 fn update_target_volume_fading_in_when_currently_below() { let mut fader = Fader::fade_in(20.0, 1.0); diff --git a/voxygen/src/audio/mod.rs b/voxygen/src/audio/mod.rs index 3205a6c991..bd33471d10 100644 --- a/voxygen/src/audio/mod.rs +++ b/voxygen/src/audio/mod.rs @@ -36,6 +36,7 @@ pub struct AudioFrontend { impl AudioFrontend { /// Construct with given device + #[allow(clippy::redundant_clone)] // TODO: Pending review in #587 pub fn new(device: String, max_sfx_channels: usize) -> Self { let mut sfx_channels = Vec::with_capacity(max_sfx_channels); let audio_device = get_device_raw(&device); @@ -165,6 +166,7 @@ impl AudioFrontend { } } + #[allow(clippy::clone_on_copy)] // TODO: Pending review in #587 pub fn set_listener_pos(&mut self, pos: &Vec3, ori: &Vec3) { self.listener_pos = pos.clone(); self.listener_ori = ori.normalized(); diff --git a/voxygen/src/audio/music.rs b/voxygen/src/audio/music.rs index 397472472f..d3469782f8 100644 --- a/voxygen/src/audio/music.rs +++ b/voxygen/src/audio/music.rs @@ -34,6 +34,7 @@ pub struct MusicMgr { } impl MusicMgr { + #[allow(clippy::new_without_default)] // TODO: Pending review in #587 pub fn new() -> Self { Self { soundtrack: Self::load_soundtrack_items(), diff --git a/voxygen/src/audio/sfx/event_mapper/combat/mod.rs b/voxygen/src/audio/sfx/event_mapper/combat/mod.rs index 75baa6d180..a025ebd001 100644 --- a/voxygen/src/audio/sfx/event_mapper/combat/mod.rs +++ b/voxygen/src/audio/sfx/event_mapper/combat/mod.rs @@ -39,6 +39,7 @@ pub struct CombatEventMapper { } impl EventMapper for CombatEventMapper { + #[allow(clippy::redundant_closure)] // TODO: Pending review in #587 fn maintain(&mut self, state: &State, player_entity: EcsEntity, triggers: &SfxTriggers) { let ecs = state.ecs(); @@ -128,6 +129,7 @@ impl CombatEventMapper { } } + #[allow(clippy::collapsible_if)] // TODO: Pending review in #587 fn map_event( character_state: &CharacterState, previous_state: &PreviousEntityState, diff --git a/voxygen/src/audio/sfx/event_mapper/movement/mod.rs b/voxygen/src/audio/sfx/event_mapper/movement/mod.rs index 6a0b184286..955aa56d94 100644 --- a/voxygen/src/audio/sfx/event_mapper/movement/mod.rs +++ b/voxygen/src/audio/sfx/event_mapper/movement/mod.rs @@ -36,6 +36,7 @@ pub struct MovementEventMapper { } impl EventMapper for MovementEventMapper { + #[allow(clippy::redundant_closure)] // TODO: Pending review in #587 fn maintain(&mut self, state: &State, player_entity: EcsEntity, triggers: &SfxTriggers) { let ecs = state.ecs(); @@ -145,6 +146,7 @@ impl MovementEventMapper { /// as opening or closing the glider. These methods translate those /// entity states with some additional data into more specific /// `SfxEvent`'s which we attach sounds to + #[allow(clippy::nonminimal_bool)] // TODO: Pending review in #587 fn map_movement_event( character_state: &CharacterState, physics_state: &PhysicsState, diff --git a/voxygen/src/audio/sfx/event_mapper/progression/mod.rs b/voxygen/src/audio/sfx/event_mapper/progression/mod.rs index e46b49bceb..6126a78cb7 100644 --- a/voxygen/src/audio/sfx/event_mapper/progression/mod.rs +++ b/voxygen/src/audio/sfx/event_mapper/progression/mod.rs @@ -26,6 +26,7 @@ pub struct ProgressionEventMapper { } impl EventMapper for ProgressionEventMapper { + #[allow(clippy::op_ref)] // TODO: Pending review in #587 fn maintain(&mut self, state: &State, player_entity: specs::Entity, triggers: &SfxTriggers) { let ecs = state.ecs(); @@ -59,6 +60,7 @@ impl ProgressionEventMapper { } } + #[allow(clippy::let_and_return)] // TODO: Pending review in #587 fn map_event(&mut self, next_state: &ProgressionState) -> Option { let sfx_event = if next_state.level > self.state.level { Some(SfxEvent::LevelUp) diff --git a/voxygen/src/audio/sfx/mod.rs b/voxygen/src/audio/sfx/mod.rs index 1e6b4f6a1b..60c2a0e163 100644 --- a/voxygen/src/audio/sfx/mod.rs +++ b/voxygen/src/audio/sfx/mod.rs @@ -125,6 +125,7 @@ pub struct SfxMgr { } impl SfxMgr { + #[allow(clippy::new_without_default)] // TODO: Pending review in #587 pub fn new() -> Self { Self { triggers: Self::load_sfx_items(), diff --git a/voxygen/src/audio/soundcache.rs b/voxygen/src/audio/soundcache.rs index 8684c69361..e9e499affc 100644 --- a/voxygen/src/audio/soundcache.rs +++ b/voxygen/src/audio/soundcache.rs @@ -1,6 +1,5 @@ use common::assets; use hashbrown::HashMap; -use rodio; use std::{convert::AsRef, io, io::Read, sync::Arc}; // Implementation of sound taken from this github issue: @@ -31,6 +30,7 @@ pub struct SoundCache { } impl SoundCache { + #[allow(clippy::new_without_default)] // TODO: Pending review in #587 pub fn new() -> Self { Self { sounds: HashMap::new(), diff --git a/voxygen/src/ecs/sys/floater.rs b/voxygen/src/ecs/sys/floater.rs index 2c3e54a3dd..08b71f2eeb 100644 --- a/voxygen/src/ecs/sys/floater.rs +++ b/voxygen/src/ecs/sys/floater.rs @@ -16,6 +16,7 @@ pub const MY_EXP_SHOWTIME: f32 = 4.0; pub struct Sys; impl<'a> System<'a> for Sys { + #[allow(clippy::type_complexity)] // TODO: Pending review in #587 type SystemData = ( Entities<'a>, ReadExpect<'a, MyEntity>, @@ -27,6 +28,8 @@ impl<'a> System<'a> for Sys { WriteStorage<'a, HpFloaterList>, ); + #[allow(clippy::block_in_if_condition_stmt)] // TODO: Pending review in #587 + #[allow(clippy::option_map_unit_fn)] // TODO: Pending review in #587 fn run( &mut self, (entities, my_entity, dt, mut my_exp_floater_list, uids, pos, stats, mut hp_floater_lists): Self::SystemData, diff --git a/voxygen/src/ecs/sys/interpolation.rs b/voxygen/src/ecs/sys/interpolation.rs index dccfdddb95..edbc54e6c9 100644 --- a/voxygen/src/ecs/sys/interpolation.rs +++ b/voxygen/src/ecs/sys/interpolation.rs @@ -11,6 +11,7 @@ use vek::*; /// This system will allow NPCs to modify their controller pub struct Sys; impl<'a> System<'a> for Sys { + #[allow(clippy::type_complexity)] // TODO: Pending review in #587 type SystemData = ( Entities<'a>, Read<'a, DeltaTime>, @@ -20,6 +21,7 @@ impl<'a> System<'a> for Sys { WriteStorage<'a, Interpolated>, ); + #[allow(clippy::option_map_unit_fn)] // TODO: Pending review in #587 fn run( &mut self, (entities, dt, positions, orientations, velocities, mut interpolated): Self::SystemData, diff --git a/voxygen/src/error.rs b/voxygen/src/error.rs index c9358e136c..46ef45fa14 100644 --- a/voxygen/src/error.rs +++ b/voxygen/src/error.rs @@ -1,5 +1,4 @@ use crate::render::RenderError; -use client; use std::fmt::Debug; /// Represents any error that may be triggered by Voxygen. diff --git a/voxygen/src/hud/bag.rs b/voxygen/src/hud/bag.rs index 03a813b47a..7e38e47cf5 100644 --- a/voxygen/src/hud/bag.rs +++ b/voxygen/src/hud/bag.rs @@ -99,6 +99,7 @@ pub struct Bag<'a> { } impl<'a> Bag<'a> { + #[allow(clippy::too_many_arguments)] // TODO: Pending review in #587 pub fn new( client: &'a Client, imgs: &'a Imgs, @@ -149,8 +150,10 @@ impl<'a> Widget for Bag<'a> { } } + #[allow(clippy::unused_unit)] // TODO: Pending review in #587 fn style(&self) -> Self::Style { () } + #[allow(clippy::useless_format)] // TODO: Pending review in #587 fn update(self, args: widget::UpdateArgs) -> Self::Event { let widget::UpdateArgs { state, ui, .. } = args; diff --git a/voxygen/src/hud/buttons.rs b/voxygen/src/hud/buttons.rs index a2b6921d32..167aa0f117 100644 --- a/voxygen/src/hud/buttons.rs +++ b/voxygen/src/hud/buttons.rs @@ -56,6 +56,7 @@ pub struct Buttons<'a> { } impl<'a> Buttons<'a> { + #[allow(clippy::too_many_arguments)] // TODO: Pending review in #587 pub fn new( client: &'a Client, show_bag: bool, @@ -105,6 +106,7 @@ impl<'a> Widget for Buttons<'a> { } } + #[allow(clippy::unused_unit)] // TODO: Pending review in #587 fn style(&self) -> Self::Style { () } fn update(self, args: widget::UpdateArgs) -> Self::Event { diff --git a/voxygen/src/hud/chat.rs b/voxygen/src/hud/chat.rs index 82b5d571eb..b190c3b17c 100644 --- a/voxygen/src/hud/chat.rs +++ b/voxygen/src/hud/chat.rs @@ -143,8 +143,12 @@ impl<'a> Widget for Chat<'a> { } } + #[allow(clippy::unused_unit)] // TODO: Pending review in #587 fn style(&self) -> Self::Style { () } + #[allow(clippy::collapsible_if)] // TODO: Pending review in #587 + #[allow(clippy::redundant_clone)] // TODO: Pending review in #587 + #[allow(clippy::single_match)] // TODO: Pending review in #587 fn update(self, args: widget::UpdateArgs) -> Self::Event { let widget::UpdateArgs { id, state, ui, .. } = args; let transp = self.global_state.settings.gameplay.chat_transp; diff --git a/voxygen/src/hud/esc_menu.rs b/voxygen/src/hud/esc_menu.rs index 230d23b2df..6ce036dfe6 100644 --- a/voxygen/src/hud/esc_menu.rs +++ b/voxygen/src/hud/esc_menu.rs @@ -67,6 +67,7 @@ impl<'a> Widget for EscMenu<'a> { } } + #[allow(clippy::unused_unit)] // TODO: Pending review in #587 fn style(&self) -> Self::Style { () } fn update(self, args: widget::UpdateArgs) -> Self::Event { diff --git a/voxygen/src/hud/item_imgs.rs b/voxygen/src/hud/item_imgs.rs index eb75d086d3..66f1289e41 100644 --- a/voxygen/src/hud/item_imgs.rs +++ b/voxygen/src/hud/item_imgs.rs @@ -28,6 +28,7 @@ pub enum ItemKey { Empty, } impl From<&Item> for ItemKey { + #[allow(clippy::clone_on_copy)] // TODO: Pending review in #587 fn from(item: &Item) -> Self { match &item.kind { ItemKind::Tool(Tool { kind, .. }) => ItemKey::Tool(kind.clone()), diff --git a/voxygen/src/hud/map.rs b/voxygen/src/hud/map.rs index 9de88cf360..b15e24772f 100644 --- a/voxygen/src/hud/map.rs +++ b/voxygen/src/hud/map.rs @@ -46,6 +46,7 @@ pub struct Map<'a> { localized_strings: &'a std::sync::Arc, } impl<'a> Map<'a> { + #[allow(clippy::too_many_arguments)] // TODO: Pending review in #587 pub fn new( show: &'a Show, client: &'a Client, @@ -89,8 +90,10 @@ impl<'a> Widget for Map<'a> { } } + #[allow(clippy::unused_unit)] // TODO: Pending review in #587 fn style(&self) -> Self::Style { () } + #[allow(clippy::useless_format)] // TODO: Pending review in #587 fn update(self, args: widget::UpdateArgs) -> Self::Event { let widget::UpdateArgs { state, ui, .. } = args; diff --git a/voxygen/src/hud/minimap.rs b/voxygen/src/hud/minimap.rs index 3895b114e1..3a0225539b 100644 --- a/voxygen/src/hud/minimap.rs +++ b/voxygen/src/hud/minimap.rs @@ -92,6 +92,7 @@ impl<'a> Widget for MiniMap<'a> { } } + #[allow(clippy::unused_unit)] // TODO: Pending review in #587 fn style(&self) -> Self::Style { () } fn update(self, args: widget::UpdateArgs) -> Self::Event { diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index 7b5770395b..a56a4feb3f 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -553,6 +553,9 @@ impl Hud { .expect("Impossible to load fonts!"); } + #[allow(clippy::assign_op_pattern)] // TODO: Pending review in #587 + #[allow(clippy::option_map_unit_fn)] // TODO: Pending review in #587 + #[allow(clippy::single_match)] // TODO: Pending review in #587 fn update_layout( &mut self, client: &Client, @@ -1906,6 +1909,7 @@ impl Hud { } } + #[allow(clippy::option_map_unit_fn)] // TODO: Pending review in #587 pub fn handle_event(&mut self, event: WinEvent, global_state: &mut GlobalState) -> bool { // Helper fn handle_slot( @@ -2132,6 +2136,7 @@ impl Hud { handled } + #[allow(clippy::block_in_if_condition_stmt)] // TODO: Pending review in #587 pub fn maintain( &mut self, client: &Client, diff --git a/voxygen/src/hud/overhead.rs b/voxygen/src/hud/overhead.rs index 238f48a3d2..da65e74d26 100644 --- a/voxygen/src/hud/overhead.rs +++ b/voxygen/src/hud/overhead.rs @@ -60,6 +60,7 @@ pub struct Overhead<'a> { } impl<'a> Overhead<'a> { + #[allow(clippy::too_many_arguments)] // TODO: Pending review in #587 pub fn new( name: &'a str, bubble: Option<&'a SpeechBubble>, @@ -117,6 +118,7 @@ impl<'a> Widget for Overhead<'a> { } } + #[allow(clippy::unused_unit)] // TODO: Pending review in #587 fn style(&self) -> Self::Style { () } fn update(self, args: widget::UpdateArgs) -> Self::Event { diff --git a/voxygen/src/hud/popup.rs b/voxygen/src/hud/popup.rs index 618cc5d570..cf59572368 100644 --- a/voxygen/src/hud/popup.rs +++ b/voxygen/src/hud/popup.rs @@ -80,8 +80,10 @@ impl<'a> Widget for Popup<'a> { } } + #[allow(clippy::unused_unit)] // TODO: Pending review in #587 fn style(&self) -> Self::Style { () } + #[allow(clippy::single_match)] // TODO: Pending review in #587 fn update(self, args: widget::UpdateArgs) -> Self::Event { let widget::UpdateArgs { state, ui, .. } = args; diff --git a/voxygen/src/hud/settings_window.rs b/voxygen/src/hud/settings_window.rs index e3fc95b383..778bf020db 100644 --- a/voxygen/src/hud/settings_window.rs +++ b/voxygen/src/hud/settings_window.rs @@ -265,6 +265,7 @@ impl<'a> Widget for SettingsWindow<'a> { } } + #[allow(clippy::unused_unit)] // TODO: Pending review in #587 fn style(&self) -> Self::Style { () } fn update(self, args: widget::UpdateArgs) -> Self::Event { diff --git a/voxygen/src/hud/skillbar.rs b/voxygen/src/hud/skillbar.rs index ebb0403cf1..fc352e4532 100644 --- a/voxygen/src/hud/skillbar.rs +++ b/voxygen/src/hud/skillbar.rs @@ -139,6 +139,7 @@ pub struct Skillbar<'a> { } impl<'a> Skillbar<'a> { + #[allow(clippy::too_many_arguments)] // TODO: Pending review in #587 pub fn new( global_state: &'a GlobalState, imgs: &'a Imgs, @@ -207,6 +208,7 @@ impl<'a> Widget for Skillbar<'a> { } } + #[allow(clippy::unused_unit)] // TODO: Pending review in #587 fn style(&self) -> Self::Style { () } fn update(self, args: widget::UpdateArgs) -> Self::Event { diff --git a/voxygen/src/hud/social.rs b/voxygen/src/hud/social.rs index fd214d098c..dbbdf519cd 100644 --- a/voxygen/src/hud/social.rs +++ b/voxygen/src/hud/social.rs @@ -77,6 +77,7 @@ impl<'a> Widget for Social<'a> { fn init_state(&self, id_gen: widget::id::Generator) -> Self::State { Ids::new(id_gen) } + #[allow(clippy::unused_unit)] // TODO: Pending review in #587 fn style(&self) -> Self::Style { () } fn update(self, args: widget::UpdateArgs) -> Self::Event { diff --git a/voxygen/src/hud/spell.rs b/voxygen/src/hud/spell.rs index a35d4bf029..4f2e0aefe1 100644 --- a/voxygen/src/hud/spell.rs +++ b/voxygen/src/hud/spell.rs @@ -67,6 +67,7 @@ impl<'a> Widget for Spell<'a> { fn init_state(&self, id_gen: widget::id::Generator) -> Self::State { Ids::new(id_gen) } + #[allow(clippy::unused_unit)] // TODO: Pending review in #587 fn style(&self) -> Self::Style { () } fn update(self, args: widget::UpdateArgs) -> Self::Event { diff --git a/voxygen/src/i18n.rs b/voxygen/src/i18n.rs index e38108bb3e..9e8a14573b 100644 --- a/voxygen/src/i18n.rs +++ b/voxygen/src/i18n.rs @@ -145,6 +145,7 @@ impl Asset for VoxygenLocalization { /// Load the translations located in the input buffer and convert them /// into a `VoxygenLocalization` object. + #[allow(clippy::into_iter_on_ref)] // TODO: Pending review in #587 fn parse(buf_reader: BufReader) -> Result { let mut asked_localization: VoxygenLocalization = from_reader(buf_reader).map_err(assets::Error::parse_error)?; diff --git a/voxygen/src/key_state.rs b/voxygen/src/key_state.rs index 91fbaf1583..1edc204ef1 100644 --- a/voxygen/src/key_state.rs +++ b/voxygen/src/key_state.rs @@ -17,6 +17,7 @@ pub struct KeyState { } impl KeyState { + #[allow(clippy::new_without_default)] // TODO: Pending review in #587 pub fn new() -> KeyState { KeyState { right: false, diff --git a/voxygen/src/logging.rs b/voxygen/src/logging.rs index 50ecbe6481..fd292bbd74 100644 --- a/voxygen/src/logging.rs +++ b/voxygen/src/logging.rs @@ -3,6 +3,7 @@ use std::fs; use crate::settings::Settings; +#[allow(clippy::or_fun_call)] // TODO: Pending review in #587 pub fn init( settings: &Settings, term_log_level: log::LevelFilter, diff --git a/voxygen/src/main.rs b/voxygen/src/main.rs index ec17079329..0449595504 100644 --- a/voxygen/src/main.rs +++ b/voxygen/src/main.rs @@ -16,6 +16,7 @@ use common::assets::{load, load_expect}; use log::{debug, error}; use std::{mem, panic, str::FromStr}; +#[allow(clippy::option_map_unit_fn)] // TODO: Pending review in #587 fn main() { #[cfg(feature = "tweak")] const_tweaker::run().expect("Could not run server"); diff --git a/voxygen/src/menu/char_selection/mod.rs b/voxygen/src/menu/char_selection/mod.rs index 983e244d86..856bf3f467 100644 --- a/voxygen/src/menu/char_selection/mod.rs +++ b/voxygen/src/menu/char_selection/mod.rs @@ -35,6 +35,7 @@ impl CharSelectionState { } impl PlayState for CharSelectionState { + #[allow(clippy::clone_on_copy)] // TODO: Pending review in #587 fn play(&mut self, _: Direction, global_state: &mut GlobalState) -> PlayStateResult { // Set up an fps clock. let mut clock = Clock::start(); diff --git a/voxygen/src/menu/char_selection/ui.rs b/voxygen/src/menu/char_selection/ui.rs index 3e705bb163..9fbbd16001 100644 --- a/voxygen/src/menu/char_selection/ui.rs +++ b/voxygen/src/menu/char_selection/ui.rs @@ -281,6 +281,7 @@ impl InfoContent { } } +#[allow(clippy::large_enum_variant)] // TODO: Pending review in #587 pub enum Mode { Select(Option>), Create { @@ -338,6 +339,7 @@ impl CharSelectionUi { } } + #[allow(clippy::clone_on_copy)] // TODO: Pending review in #587 pub fn get_character_list(&self) -> Option> { match &self.mode { Mode::Select(data) => data.clone(), @@ -396,6 +398,10 @@ impl CharSelectionUi { } // TODO: Split this into multiple modules or functions. + #[allow(clippy::clone_on_copy)] // TODO: Pending review in #587 + #[allow(clippy::collapsible_if)] // TODO: Pending review in #587 + #[allow(clippy::useless_let_if_seq)] // TODO: Pending review in #587 + #[allow(clippy::unnecessary_operation)] // TODO: Pending review in #587 fn update_layout(&mut self, client: &mut Client) -> Vec { let mut events = Vec::new(); diff --git a/voxygen/src/menu/main/client_init.rs b/voxygen/src/menu/main/client_init.rs index 87e33fee55..02c171ac5b 100644 --- a/voxygen/src/menu/main/client_init.rs +++ b/voxygen/src/menu/main/client_init.rs @@ -22,6 +22,7 @@ pub enum Error { ClientCrashed, } +#[allow(clippy::large_enum_variant)] // TODO: Pending review in #587 pub enum Msg { IsAuthTrusted(String), Done(Result), @@ -38,6 +39,8 @@ pub struct ClientInit { cancel: Arc, } impl ClientInit { + #[allow(clippy::op_ref)] // TODO: Pending review in #587 + #[allow(clippy::or_fun_call)] // TODO: Pending review in #587 pub fn new( connection_args: (String, u16, bool), username: String, diff --git a/voxygen/src/menu/main/mod.rs b/voxygen/src/menu/main/mod.rs index 27382c26ea..32c9f2c488 100644 --- a/voxygen/src/menu/main/mod.rs +++ b/voxygen/src/menu/main/mod.rs @@ -28,6 +28,8 @@ impl MainMenuState { const DEFAULT_PORT: u16 = 14004; impl PlayState for MainMenuState { + #[allow(clippy::option_map_unit_fn)] // TODO: Pending review in #587 + #[allow(clippy::useless_format)] // TODO: Pending review in #587 fn play(&mut self, _: Direction, global_state: &mut GlobalState) -> PlayStateResult { // Set up an fps clock. let mut clock = Clock::start(); diff --git a/voxygen/src/menu/main/ui.rs b/voxygen/src/menu/main/ui.rs index 48f0b6fffb..a9e66c4ec0 100644 --- a/voxygen/src/menu/main/ui.rs +++ b/voxygen/src/menu/main/ui.rs @@ -162,6 +162,7 @@ pub struct MainMenuUi { } impl MainMenuUi { + #[allow(clippy::redundant_closure)] // TODO: Pending review in #587 pub fn new(global_state: &mut GlobalState) -> Self { let window = &mut global_state.window; let networking = &global_state.settings.networking; @@ -228,6 +229,9 @@ impl MainMenuUi { } } + #[allow(clippy::assign_op_pattern)] // TODO: Pending review in #587 + #[allow(clippy::op_ref)] // TODO: Pending review in #587 + #[allow(clippy::toplevel_ref_arg)] // TODO: Pending review in #587 fn update_layout(&mut self, global_state: &mut GlobalState, dt: Duration) -> Vec { let mut events = Vec::new(); self.time = self.time + dt.as_secs_f32(); diff --git a/voxygen/src/mesh/segment.rs b/voxygen/src/mesh/segment.rs index fff654f888..c69d348b45 100644 --- a/voxygen/src/mesh/segment.rs +++ b/voxygen/src/mesh/segment.rs @@ -23,6 +23,8 @@ where type Supplement = (Vec3, Vec3); type TranslucentPipeline = FigurePipeline; + #[allow(clippy::needless_range_loop)] // TODO: Pending review in #587 + #[allow(clippy::or_fun_call)] // TODO: Pending review in #587 fn generate_mesh( &'a self, (offs, scale): Self::Supplement, @@ -89,6 +91,8 @@ where type Supplement = (Vec3, Vec3); type TranslucentPipeline = SpritePipeline; + #[allow(clippy::needless_range_loop)] // TODO: Pending review in #587 + #[allow(clippy::or_fun_call)] // TODO: Pending review in #587 fn generate_mesh( &'a self, (offs, scale): Self::Supplement, diff --git a/voxygen/src/mesh/terrain.rs b/voxygen/src/mesh/terrain.rs index c71b959c9b..875194b187 100644 --- a/voxygen/src/mesh/terrain.rs +++ b/voxygen/src/mesh/terrain.rs @@ -18,6 +18,7 @@ trait Blendable { } impl Blendable for BlockKind { + #[allow(clippy::match_single_binding)] // TODO: Pending review in #587 fn is_blended(&self) -> bool { match self { _ => false, @@ -205,6 +206,12 @@ impl<'a, V: RectRasterableVol + ReadVol + Debug> type Supplement = Aabb; type TranslucentPipeline = FluidPipeline; + #[allow(clippy::collapsible_if)] // TODO: Pending review in #587 + #[allow(clippy::many_single_char_names)] // TODO: Pending review in #587 + #[allow(clippy::needless_range_loop)] // TODO: Pending review in #587 + #[allow(clippy::or_fun_call)] // TODO: Pending review in #587 + #[allow(clippy::panic_params)] // TODO: Pending review in #587 + #[allow(clippy::redundant_closure)] // TODO: Pending review in #587 fn generate_mesh( &'a self, range: Self::Supplement, diff --git a/voxygen/src/render/consts.rs b/voxygen/src/render/consts.rs index f78ec24dc5..8f6f7b7ec7 100644 --- a/voxygen/src/render/consts.rs +++ b/voxygen/src/render/consts.rs @@ -18,6 +18,7 @@ impl Consts { } /// Update the GPU-side value represented by this constant handle. + #[allow(clippy::redundant_closure)] // TODO: Pending review in #587 pub fn update( &mut self, encoder: &mut gfx::Encoder, diff --git a/voxygen/src/render/error.rs b/voxygen/src/render/error.rs index 85c08ca4a2..b2e659565f 100644 --- a/voxygen/src/render/error.rs +++ b/voxygen/src/render/error.rs @@ -17,6 +17,7 @@ impl From> for RenderError { } impl From> for RenderError { + #[allow(clippy::identity_conversion)] // TODO: Pending review in #587 fn from(err: gfx::PipelineStateError<&str>) -> Self { match err { gfx::PipelineStateError::DescriptorInit(err) => { diff --git a/voxygen/src/render/instances.rs b/voxygen/src/render/instances.rs index fb333daba9..1feaafb5ed 100644 --- a/voxygen/src/render/instances.rs +++ b/voxygen/src/render/instances.rs @@ -12,6 +12,7 @@ pub struct Instances { } impl Instances { + #[allow(clippy::redundant_closure)] // TODO: Pending review in #587 pub fn new(factory: &mut gfx_backend::Factory, len: usize) -> Result { Ok(Self { ibuf: factory @@ -22,6 +23,7 @@ impl Instances { pub fn count(&self) -> usize { self.ibuf.len() } + #[allow(clippy::redundant_closure)] // TODO: Pending review in #587 pub fn update( &mut self, encoder: &mut gfx::Encoder, diff --git a/voxygen/src/render/mesh.rs b/voxygen/src/render/mesh.rs index d0c48275c6..6b345505bb 100644 --- a/voxygen/src/render/mesh.rs +++ b/voxygen/src/render/mesh.rs @@ -18,6 +18,7 @@ where impl Mesh

{ /// Create a new `Mesh`. + #[allow(clippy::new_without_default)] // TODO: Pending review in #587 pub fn new() -> Self { Self { verts: vec![] } } /// Clear vertices, allows reusing allocated memory of the underlying Vec. diff --git a/voxygen/src/render/mod.rs b/voxygen/src/render/mod.rs index 906493865b..605ca1e4e2 100644 --- a/voxygen/src/render/mod.rs +++ b/voxygen/src/render/mod.rs @@ -1,3 +1,4 @@ +#[allow(clippy::single_component_path_imports)] // TODO: Pending review in #587 pub mod consts; mod error; pub mod instances; @@ -37,8 +38,6 @@ pub use self::{ #[cfg(feature = "gl")] use gfx_device_gl as gfx_backend; -use gfx; - /// Used to represent a specific rendering configuration. /// /// Note that pipelines are tied to the diff --git a/voxygen/src/render/model.rs b/voxygen/src/render/model.rs index a48ec53bc8..20ef6c7c52 100644 --- a/voxygen/src/render/model.rs +++ b/voxygen/src/render/model.rs @@ -30,6 +30,7 @@ pub struct DynamicModel { } impl DynamicModel

{ + #[allow(clippy::redundant_closure)] // TODO: Pending review in #587 pub fn new(factory: &mut gfx_backend::Factory, size: usize) -> Result { Ok(Self { vbuf: factory @@ -47,6 +48,7 @@ impl DynamicModel

{ } } + #[allow(clippy::redundant_closure)] // TODO: Pending review in #587 pub fn update( &self, encoder: &mut gfx::Encoder, diff --git a/voxygen/src/render/pipelines/figure.rs b/voxygen/src/render/pipelines/figure.rs index 4a68b224a9..af22de0b1d 100644 --- a/voxygen/src/render/pipelines/figure.rs +++ b/voxygen/src/render/pipelines/figure.rs @@ -46,6 +46,7 @@ gfx_defines! { } impl Vertex { + #[allow(clippy::collapsible_if)] // TODO: Pending review in #587 pub fn new(pos: Vec3, norm: Vec3, col: Rgb, ao: f32, bone_idx: u8) -> Self { let norm_bits = if norm.x != 0.0 { if norm.x < 0.0 { 0 } else { 1 } diff --git a/voxygen/src/render/pipelines/fluid.rs b/voxygen/src/render/pipelines/fluid.rs index 2e67ae9600..040a757a07 100644 --- a/voxygen/src/render/pipelines/fluid.rs +++ b/voxygen/src/render/pipelines/fluid.rs @@ -33,6 +33,8 @@ gfx_defines! { } impl Vertex { + #[allow(clippy::identity_op)] // TODO: Pending review in #587 + #[allow(clippy::into_iter_on_ref)] // TODO: Pending review in #587 pub fn new(pos: Vec3, norm: Vec3, col: Rgb, light: f32, _opac: f32) -> Self { let (norm_axis, norm_dir) = norm .as_slice() diff --git a/voxygen/src/render/pipelines/mod.rs b/voxygen/src/render/pipelines/mod.rs index 5ca7182521..3f661a2cdc 100644 --- a/voxygen/src/render/pipelines/mod.rs +++ b/voxygen/src/render/pipelines/mod.rs @@ -44,6 +44,8 @@ gfx_defines! { impl Globals { /// Create global consts from the provided parameters. + #[allow(clippy::or_fun_call)] // TODO: Pending review in #587 + #[allow(clippy::too_many_arguments)] // TODO: Pending review in #587 pub fn new( view_mat: Mat4, proj_mat: Mat4, diff --git a/voxygen/src/render/pipelines/sprite.rs b/voxygen/src/render/pipelines/sprite.rs index f5ef6e8d2e..0829727dcd 100644 --- a/voxygen/src/render/pipelines/sprite.rs +++ b/voxygen/src/render/pipelines/sprite.rs @@ -45,6 +45,7 @@ gfx_defines! { } impl Vertex { + #[allow(clippy::collapsible_if)] // TODO: Pending review in #587 pub fn new(pos: Vec3, norm: Vec3, col: Rgb, ao: f32) -> Self { let norm_bits = if norm.x != 0.0 { if norm.x < 0.0 { 0 } else { 1 } diff --git a/voxygen/src/render/pipelines/terrain.rs b/voxygen/src/render/pipelines/terrain.rs index 9d6f884ff4..e43cdc99ae 100644 --- a/voxygen/src/render/pipelines/terrain.rs +++ b/voxygen/src/render/pipelines/terrain.rs @@ -37,6 +37,7 @@ gfx_defines! { } impl Vertex { + #[allow(clippy::identity_op)] // TODO: Pending review in #587 pub fn new(norm_bits: u32, light: u32, ao: u32, pos: Vec3, col: Rgb) -> Self { const EXTRA_NEG_Z: f32 = 65536.0; diff --git a/voxygen/src/render/pipelines/ui.rs b/voxygen/src/render/pipelines/ui.rs index 35ba91bb86..9078ebf3c5 100644 --- a/voxygen/src/render/pipelines/ui.rs +++ b/voxygen/src/render/pipelines/ui.rs @@ -87,6 +87,7 @@ impl Mode { } } +#[allow(clippy::many_single_char_names)] // TODO: Pending review in #587 pub fn create_quad( rect: Aabr, uv_rect: Aabr, diff --git a/voxygen/src/render/renderer.rs b/voxygen/src/render/renderer.rs index ab369c7419..9dd874c083 100644 --- a/voxygen/src/render/renderer.rs +++ b/voxygen/src/render/renderer.rs @@ -445,6 +445,7 @@ impl Renderer { /// Creates a download buffer, downloads the win_color_view, and converts to /// a image::DynamicImage. + #[allow(clippy::map_clone)] // TODO: Pending review in #587 pub fn create_screenshot(&mut self) -> Result { let (width, height) = self.get_resolution().into_tuple(); use gfx::{ @@ -781,6 +782,7 @@ struct GfxPipeline { } /// Creates all the pipelines used to render. +#[allow(clippy::type_complexity)] // TODO: Pending review in #587 fn create_pipelines( factory: &mut gfx_backend::Factory, aa_mode: AaMode, @@ -983,6 +985,7 @@ fn create_pipelines( } /// Create a new pipeline from the provided vertex shader and fragment shader. +#[allow(clippy::extra_unused_lifetimes)] // TODO: Pending review in #587 fn create_pipeline<'a, P: gfx::pso::PipelineInit>( factory: &mut gfx_backend::Factory, pipe: P, diff --git a/voxygen/src/render/texture.rs b/voxygen/src/render/texture.rs index 141eeb9a25..30a55a273d 100644 --- a/voxygen/src/render/texture.rs +++ b/voxygen/src/render/texture.rs @@ -26,6 +26,7 @@ where F::Channel: gfx::format::TextureChannel, ::DataType: Copy, { + #[allow(clippy::redundant_closure)] // TODO: Pending review in #587 pub fn new( factory: &mut gfx_backend::Factory, image: &DynamicImage, @@ -88,6 +89,7 @@ where /// Update a texture with the given data (used for updating the glyph cache /// texture). + #[allow(clippy::redundant_closure)] // TODO: Pending review in #587 pub fn update( &self, encoder: &mut gfx::Encoder, diff --git a/voxygen/src/scene/figure/cache.rs b/voxygen/src/scene/figure/cache.rs index 0460279033..be6778e981 100644 --- a/voxygen/src/scene/figure/cache.rs +++ b/voxygen/src/scene/figure/cache.rs @@ -21,6 +21,7 @@ use std::{ }; use vek::*; +#[allow(clippy::large_enum_variant)] // TODO: Pending review in #587 #[derive(PartialEq, Eq, Hash, Clone)] enum FigureKey { Simple(Body), @@ -64,6 +65,7 @@ impl CharacterCacheKey { } } +#[allow(clippy::type_complexity)] // TODO: Pending review in #587 pub struct FigureModelCache where Skel: Skeleton, @@ -73,6 +75,7 @@ where } impl FigureModelCache { + #[allow(clippy::new_without_default)] // TODO: Pending review in #587 pub fn new() -> Self { Self { models: HashMap::new(), diff --git a/voxygen/src/scene/figure/mod.rs b/voxygen/src/scene/figure/mod.rs index 63a24ce21f..ca526ef84f 100644 --- a/voxygen/src/scene/figure/mod.rs +++ b/voxygen/src/scene/figure/mod.rs @@ -66,6 +66,7 @@ pub struct FigureMgr { } impl FigureMgr { + #[allow(clippy::new_without_default)] // TODO: Pending review in #587 pub fn new() -> Self { Self { model_cache: FigureModelCache::new(), @@ -108,6 +109,7 @@ impl FigureMgr { self.golem_model_cache.clean(tick); } + #[allow(clippy::redundant_pattern_matching)] // TODO: Pending review in #587 pub fn update_lighting(&mut self, scene_data: &SceneData) { let ecs = scene_data.state.ecs(); for (entity, light_emitter) in (&ecs.entities(), &ecs.read_storage::()).join() @@ -170,6 +172,8 @@ impl FigureMgr { } } + #[allow(clippy::option_map_unit_fn)] // TODO: Pending review in #587 + #[allow(clippy::or_fun_call)] // TODO: Pending review in #587 pub fn maintain(&mut self, renderer: &mut Renderer, scene_data: &SceneData, camera: &Camera) { let state = scene_data.state; let time = state.get_time(); @@ -1570,6 +1574,7 @@ impl FigureMgr { .retain(|entity, _| ecs.entities().is_alive(*entity)); } + #[allow(clippy::too_many_arguments)] // TODO: Pending review in #587 pub fn render( &mut self, renderer: &mut Renderer, @@ -1622,6 +1627,7 @@ impl FigureMgr { } } + #[allow(clippy::too_many_arguments)] // TODO: Pending review in #587 pub fn render_player( &mut self, renderer: &mut Renderer, @@ -1671,6 +1677,7 @@ impl FigureMgr { } } + #[allow(clippy::too_many_arguments)] // TODO: Pending review in #587 fn render_figure( &mut self, renderer: &mut Renderer, @@ -2035,6 +2042,7 @@ impl FigureState { } } + #[allow(clippy::too_many_arguments)] // TODO: Pending review in #587 pub fn update( &mut self, renderer: &mut Renderer, diff --git a/voxygen/src/scene/terrain.rs b/voxygen/src/scene/terrain.rs index 8f15a120dc..23b4b2020d 100644 --- a/voxygen/src/scene/terrain.rs +++ b/voxygen/src/scene/terrain.rs @@ -247,6 +247,8 @@ fn sprite_config_for(kind: BlockKind) -> Option { } /// Function executed by worker threads dedicated to chunk meshing. +#[allow(clippy::or_fun_call)] // TODO: Pending review in #587 +#[allow(clippy::redundant_closure)] // TODO: Pending review in #587 fn mesh_worker + RectRasterableVol + ReadVol + Debug>( pos: Vec2, z_bounds: (f32, f32), @@ -321,6 +323,7 @@ pub struct Terrain { } impl Terrain { + #[allow(clippy::float_cmp)] // TODO: Pending review in #587 pub fn new(renderer: &mut Renderer) -> Self { // Create a new mpsc (Multiple Produced, Single Consumer) pair for communicating // with worker threads that are meshing chunks. @@ -1878,6 +1881,8 @@ impl Terrain { } /// Maintain terrain data. To be called once per tick. + #[allow(clippy::for_loop_over_option)] // TODO: Pending review in #587 + #[allow(clippy::len_zero)] // TODO: Pending review in #587 pub fn maintain( &mut self, renderer: &mut Renderer, diff --git a/voxygen/src/settings.rs b/voxygen/src/settings.rs index 140ca54732..ca44109e12 100644 --- a/voxygen/src/settings.rs +++ b/voxygen/src/settings.rs @@ -539,6 +539,7 @@ pub struct Log { } impl Default for Log { + #[allow(clippy::or_fun_call)] // TODO: Pending review in #587 fn default() -> Self { let proj_dirs = ProjectDirs::from("net", "veloren", "voxygen") .expect("System's $HOME directory path not found!"); @@ -674,6 +675,8 @@ pub struct Settings { } impl Default for Settings { + #[allow(clippy::or_fun_call)] // TODO: Pending review in #587 + #[allow(clippy::redundant_closure)] // TODO: Pending review in #587 fn default() -> Self { let user_dirs = UserDirs::new().expect("System's $HOME directory path not found!"); diff --git a/voxygen/src/ui/event.rs b/voxygen/src/ui/event.rs index ebdae03faa..c9a3dde678 100644 --- a/voxygen/src/ui/event.rs +++ b/voxygen/src/ui/event.rs @@ -4,6 +4,7 @@ use vek::*; #[derive(Clone)] pub struct Event(pub Input); impl Event { + #[allow(clippy::redundant_closure)] // TODO: Pending review in #587 pub fn try_from( event: glutin::Event, window: &glutin::ContextWrapper, diff --git a/voxygen/src/ui/fonts.rs b/voxygen/src/ui/fonts.rs index c42b9abf3a..b1f5924249 100644 --- a/voxygen/src/ui/fonts.rs +++ b/voxygen/src/ui/fonts.rs @@ -6,6 +6,7 @@ pub struct ConrodVoxygenFont { } impl ConrodVoxygenFont { + #[allow(clippy::needless_return)] // TODO: Pending review in #587 pub fn new(font: &Font, ui: &mut crate::ui::Ui) -> ConrodVoxygenFont { return Self { metadata: font.clone(), diff --git a/voxygen/src/ui/graphic/pixel_art.rs b/voxygen/src/ui/graphic/pixel_art.rs index af5ab08d00..f3994b4375 100644 --- a/voxygen/src/ui/graphic/pixel_art.rs +++ b/voxygen/src/ui/graphic/pixel_art.rs @@ -33,6 +33,7 @@ const EPSILON: f32 = 0.0001; // we can now calculate the combined alpha value // and E6 can then be solved for c3 // E9: c3 = (A1 * c1 * a1 + A2 * c2 * a2) / a3 +#[allow(clippy::manual_saturating_arithmetic)] // TODO: Pending review in #587 pub fn resize_pixel_art(image: &RgbaImage, new_width: u32, new_height: u32) -> RgbaImage { let (width, height) = image.dimensions(); let mut new_image = RgbaImage::new(new_width, new_height); diff --git a/voxygen/src/ui/graphic/renderer.rs b/voxygen/src/ui/graphic/renderer.rs index 946b464a54..f21039b3a9 100644 --- a/voxygen/src/ui/graphic/renderer.rs +++ b/voxygen/src/ui/graphic/renderer.rs @@ -67,6 +67,7 @@ impl euc::Interpolate for VsOut { } #[inline(always)] + #[allow(clippy::many_single_char_names)] // TODO: Pending review in #587 fn lerp3(a: Self, b: Self, c: Self, x: f32, y: f32, z: f32) -> Self { //a * x + b * y + c * z Self( diff --git a/voxygen/src/ui/mod.rs b/voxygen/src/ui/mod.rs index 4fcd0cb170..a843403f9c 100644 --- a/voxygen/src/ui/mod.rs +++ b/voxygen/src/ui/mod.rs @@ -90,6 +90,7 @@ pub struct Font(text::Font); impl assets::Asset for Font { const ENDINGS: &'static [&'static str] = &["ttf"]; + #[allow(clippy::redundant_clone)] // TODO: Pending review in #587 fn parse(mut buf_reader: BufReader) -> Result { let mut buf = Vec::new(); buf_reader.read_to_end(&mut buf)?; @@ -266,6 +267,7 @@ impl Ui { pub fn widget_input(&self, id: widget::Id) -> Widget { self.ui.widget_input(id) } + #[allow(clippy::float_cmp)] // TODO: Pending review in #587 pub fn maintain(&mut self, renderer: &mut Renderer, view_projection_mat: Option>) { // Maintain tooltip manager self.tooltip_manager diff --git a/voxygen/src/ui/widgets/ghost_image.rs b/voxygen/src/ui/widgets/ghost_image.rs index cc47c6adaa..272e177b84 100644 --- a/voxygen/src/ui/widgets/ghost_image.rs +++ b/voxygen/src/ui/widgets/ghost_image.rs @@ -39,6 +39,7 @@ impl Widget for GhostImage { } } + #[allow(clippy::clone_on_copy)] // TODO: Pending review in #587 fn style(&self) -> Self::Style { self.style.clone() } fn update(self, args: widget::UpdateArgs) -> Self::Event { diff --git a/voxygen/src/ui/widgets/image_frame.rs b/voxygen/src/ui/widgets/image_frame.rs index 4746de3118..03ed80da99 100644 --- a/voxygen/src/ui/widgets/image_frame.rs +++ b/voxygen/src/ui/widgets/image_frame.rs @@ -133,6 +133,7 @@ impl Widget for ImageFrame { } } + #[allow(clippy::unused_unit)] // TODO: Pending review in #587 fn style(&self) -> Self::Style { () } /// Update the state of the ImageFrame diff --git a/voxygen/src/ui/widgets/image_slider.rs b/voxygen/src/ui/widgets/image_slider.rs index f7111d9e66..fc9ab05938 100644 --- a/voxygen/src/ui/widgets/image_slider.rs +++ b/voxygen/src/ui/widgets/image_slider.rs @@ -178,6 +178,7 @@ where } } + #[allow(clippy::unused_unit)] // TODO: Pending review in #587 fn style(&self) -> Self::Style { () } /// Update the state of the Slider. diff --git a/voxygen/src/ui/widgets/ingame.rs b/voxygen/src/ui/widgets/ingame.rs index 5009779f0d..e8f5ccf49f 100644 --- a/voxygen/src/ui/widgets/ingame.rs +++ b/voxygen/src/ui/widgets/ingame.rs @@ -87,6 +87,7 @@ impl Widget for Ingame { } } + #[allow(clippy::unused_unit)] // TODO: Pending review in #587 fn style(&self) -> Self::Style { () } fn update(self, args: widget::UpdateArgs) -> Self::Event { diff --git a/voxygen/src/ui/widgets/radio_list.rs b/voxygen/src/ui/widgets/radio_list.rs index 71af9ab761..1c250c01b2 100644 --- a/voxygen/src/ui/widgets/radio_list.rs +++ b/voxygen/src/ui/widgets/radio_list.rs @@ -113,8 +113,10 @@ impl<'a, T> Widget for RadioList<'a, T> { } } + #[allow(clippy::unused_unit)] // TODO: Pending review in #587 fn style(&self) -> Self::Style { () } + #[allow(clippy::needless_range_loop)] // TODO: Pending review in #587 fn update(self, args: widget::UpdateArgs) -> Self::Event { let widget::UpdateArgs { id, diff --git a/voxygen/src/ui/widgets/slot.rs b/voxygen/src/ui/widgets/slot.rs index 78a7d79260..ede57d47cd 100644 --- a/voxygen/src/ui/widgets/slot.rs +++ b/voxygen/src/ui/widgets/slot.rs @@ -370,6 +370,7 @@ where self } + #[allow(clippy::too_many_arguments)] // TODO: Pending review in #587 fn new( slot_key: K, empty_slot: image::Id, @@ -421,6 +422,7 @@ where } } + #[allow(clippy::unused_unit)] // TODO: Pending review in #587 fn style(&self) -> Self::Style { () } /// Update the state of the Slider. diff --git a/voxygen/src/ui/widgets/toggle_button.rs b/voxygen/src/ui/widgets/toggle_button.rs index a4c9533a0b..5aacb0e4f9 100644 --- a/voxygen/src/ui/widgets/toggle_button.rs +++ b/voxygen/src/ui/widgets/toggle_button.rs @@ -87,6 +87,7 @@ impl Widget for ToggleButton { } } + #[allow(clippy::unused_unit)] // TODO: Pending review in #587 fn style(&self) -> Self::Style { () } fn update(self, args: widget::UpdateArgs) -> Self::Event { diff --git a/voxygen/src/ui/widgets/tooltip.rs b/voxygen/src/ui/widgets/tooltip.rs index fe81bb716e..6084da25e4 100644 --- a/voxygen/src/ui/widgets/tooltip.rs +++ b/voxygen/src/ui/widgets/tooltip.rs @@ -91,6 +91,7 @@ impl TooltipManager { } } + #[allow(clippy::too_many_arguments)] // TODO: Pending review in #587 fn set_tooltip( &mut self, tooltip: &Tooltip, @@ -367,6 +368,7 @@ impl<'a> Widget for Tooltip<'a> { fn style(&self) -> Self::Style { self.style.clone() } + #[allow(clippy::collapsible_if)] // TODO: Pending review in #587 fn update(self, args: widget::UpdateArgs) { let widget::UpdateArgs { id, diff --git a/voxygen/src/window.rs b/voxygen/src/window.rs index 70db080825..36edd56d64 100644 --- a/voxygen/src/window.rs +++ b/voxygen/src/window.rs @@ -499,6 +499,7 @@ impl Window { pub fn renderer_mut(&mut self) -> &mut Renderer { &mut self.renderer } + #[allow(clippy::match_bool)] // TODO: Pending review in #587 pub fn fetch_events(&mut self, settings: &mut Settings) -> Vec { let mut events = vec![]; events.append(&mut self.supplement_events); @@ -924,6 +925,7 @@ impl Window { pub fn needs_refresh_resize(&mut self) { self.needs_refresh_resize = true; } + #[allow(clippy::or_fun_call)] // TODO: Pending review in #587 pub fn logical_size(&self) -> Vec2 { let (w, h) = self .window diff --git a/voxygen/tests/check_i18n_files.rs b/voxygen/tests/check_i18n_files.rs index 2efe365826..350a2979c6 100644 --- a/voxygen/tests/check_i18n_files.rs +++ b/voxygen/tests/check_i18n_files.rs @@ -48,6 +48,7 @@ impl LocalizationEntryState { } /// Returns the Git blob associated with the given reference and path +#[allow(clippy::expect_fun_call)] // TODO: Pending review in #587 fn read_file_from_path<'a>( repo: &'a git2::Repository, reference: &git2::Reference, @@ -136,6 +137,9 @@ fn generate_key_version<'a>( #[test] #[ignore] +#[allow(clippy::expect_fun_call)] // TODO: Pending review in #587 +#[allow(clippy::extra_unused_lifetimes)] // TODO: Pending review in #587 +#[allow(clippy::or_fun_call)] // TODO: Pending review in #587 fn test_all_localizations<'a>() { // Generate paths let i18n_asset_path = Path::new("assets/voxygen/i18n/"); diff --git a/world/examples/settlement_viewer.rs b/world/examples/settlement_viewer.rs index ccfb4e321d..8c11222241 100644 --- a/world/examples/settlement_viewer.rs +++ b/world/examples/settlement_viewer.rs @@ -5,6 +5,7 @@ use veloren_world::site::Settlement; const W: usize = 640; const H: usize = 480; +#[allow(clippy::or_fun_call)] // TODO: Pending review in #587 fn main() { let mut win = minifb::Window::new("Settlement Viewer", W, H, minifb::WindowOptions::default()).unwrap(); diff --git a/world/examples/water.rs b/world/examples/water.rs index 5c6e35a834..0e3bd6c594 100644 --- a/world/examples/water.rs +++ b/world/examples/water.rs @@ -9,6 +9,9 @@ use veloren_world::{ const W: usize = 1024; const H: usize = 1024; +#[allow(clippy::collapsible_if)] // TODO: Pending review in #587 +#[allow(clippy::needless_update)] // TODO: Pending review in #587 +#[allow(clippy::unused_io_amount)] // TODO: Pending review in #587 fn main() { pretty_env_logger::init(); diff --git a/world/src/block/mod.rs b/world/src/block/mod.rs index fdcd9f1307..38a81ec230 100644 --- a/world/src/block/mod.rs +++ b/world/src/block/mod.rs @@ -25,6 +25,7 @@ impl<'a> BlockGen<'a> { } } + #[allow(clippy::identity_conversion)] // TODO: Pending review in #587 pub fn sample_column<'b>( column_gen: &ColumnGen<'a>, cache: &'b mut SmallCache>>, @@ -35,6 +36,7 @@ impl<'a> BlockGen<'a> { .as_ref() } + #[allow(clippy::identity_conversion)] // TODO: Pending review in #587 fn get_cliff_height( column_gen: &ColumnGen<'a>, cache: &mut SmallCache>>, @@ -89,6 +91,7 @@ impl<'a> BlockGen<'a> { ) } + #[allow(clippy::identity_conversion)] // TODO: Pending review in #587 pub fn get_z_cache(&mut self, wpos: Vec2) -> Option> { let BlockGen { column_cache, @@ -138,6 +141,8 @@ impl<'a> BlockGen<'a> { }) } + #[allow(clippy::identity_op)] // TODO: Pending review in #587 + #[allow(clippy::or_fun_call)] // TODO: Pending review in #587 pub fn get_with_z_cache( &mut self, wpos: Vec3, @@ -418,6 +423,7 @@ pub struct ZCache<'a> { } impl<'a> ZCache<'a> { + #[allow(clippy::unnecessary_mut_passed)] // TODO: Pending review in #587 pub fn get_z_limits(&self, block_gen: &mut BlockGen) -> (f32, f32, f32) { let cave_depth = if self.sample.cave_xy.abs() > 0.9 && self.sample.water_level <= self.sample.alt { @@ -549,6 +555,7 @@ impl StructureInfo { } } +#[allow(clippy::identity_op)] // TODO: Pending review in #587 pub fn block_from_structure( sblock: StructureBlock, pos: Vec3, diff --git a/world/src/civ/mod.rs b/world/src/civ/mod.rs index fd262786f4..b1458f1659 100644 --- a/world/src/civ/mod.rs +++ b/world/src/civ/mod.rs @@ -29,6 +29,7 @@ use vek::*; const INITIAL_CIV_COUNT: usize = (crate::sim::WORLD_SIZE.x * crate::sim::WORLD_SIZE.y * 3) / 65536; //48 at default scale +#[allow(clippy::type_complexity)] // TODO: Pending review in #587 #[derive(Default)] pub struct Civs { civs: Store, @@ -68,6 +69,8 @@ impl<'a, R: Rng> GenCtx<'a, R> { } impl Civs { + #[allow(clippy::identity_conversion)] // TODO: Pending review in #587 + #[allow(clippy::option_map_unit_fn)] // TODO: Pending review in #587 pub fn generate(seed: u32, sim: &mut WorldSim) -> Self { let mut this = Self::default(); let rng = ChaChaRng::from_seed(seed_expan::rng_state(seed)); @@ -197,6 +200,7 @@ impl Civs { pub fn sites(&self) -> impl Iterator + '_ { self.sites.iter() } #[allow(dead_code)] + #[allow(clippy::print_literal)] // TODO: Pending review in #587 fn display_info(&self) { for (id, civ) in self.civs.iter_ids() { println!("# Civilisation {:?}", id); @@ -594,6 +598,8 @@ fn loc_suitable_for_site(sim: &WorldSim, loc: Vec2) -> bool { } /// Attempt to search for a location that's suitable for site construction +#[allow(clippy::identity_conversion)] // TODO: Pending review in #587 +#[allow(clippy::or_fun_call)] // TODO: Pending review in #587 fn find_site_loc(ctx: &mut GenCtx, near: Option<(Vec2, f32)>) -> Option> { const MAX_ATTEMPTS: usize = 100; let mut loc = None; @@ -762,6 +768,7 @@ pub enum SiteKind { } impl Site { + #[allow(clippy::let_and_return)] // TODO: Pending review in #587 pub fn simulate(&mut self, years: f32, nat_res: &NaturalResources) { // Insert natural resources into the economy if self.stocks[Fish] < nat_res.river { @@ -1035,6 +1042,7 @@ impl MapVec { pub fn get(&self, entry: K) -> &T { self.entries.get(&entry).unwrap_or(&self.default) } + #[allow(clippy::clone_on_copy)] // TODO: Pending review in #587 pub fn map(self, mut f: impl FnMut(K, T) -> U) -> MapVec { MapVec { entries: self diff --git a/world/src/column/mod.rs b/world/src/column/mod.rs index 000be4c08a..c648ab29ca 100644 --- a/world/src/column/mod.rs +++ b/world/src/column/mod.rs @@ -22,6 +22,7 @@ pub struct ColumnGen<'a> { impl<'a> ColumnGen<'a> { pub fn new(sim: &'a WorldSim) -> Self { Self { sim } } + #[allow(clippy::if_same_then_else)] // TODO: Pending review in #587 fn get_local_structure(&self, wpos: Vec2) -> Option { let (pos, seed) = self .sim @@ -95,6 +96,8 @@ fn river_spline_coeffs( /// curve"... hopefully this works out okay and gives us what we want (a /// river that extends outwards tangent to a quadratic curve, with width /// configured by distance along the line). +#[allow(clippy::let_and_return)] // TODO: Pending review in #587 +#[allow(clippy::many_single_char_names)] pub fn quadratic_nearest_point( spline: &Vec3>, point: Vec2, @@ -165,6 +168,11 @@ impl<'a> Sampler<'a> for ColumnGen<'a> { type Index = Vec2; type Sample = Option>; + #[allow(clippy::collapsible_if)] // TODO: Pending review in #587 + #[allow(clippy::float_cmp)] // TODO: Pending review in #587 + #[allow(clippy::if_same_then_else)] // TODO: Pending review in #587 + #[allow(clippy::nonminimal_bool)] // TODO: Pending review in #587 + #[allow(clippy::single_match)] // TODO: Pending review in #587 fn get(&self, wpos: Vec2) -> Option> { let wposf = wpos.map(|e| e as f64); let chunk_pos = wpos.map2(TerrainChunkSize::RECT_SIZE, |e, sz: u32| e / sz as i32); diff --git a/world/src/lib.rs b/world/src/lib.rs index 6f47c7a311..3854b1c2e6 100644 --- a/world/src/lib.rs +++ b/world/src/lib.rs @@ -63,6 +63,8 @@ impl World { pub fn sample_blocks(&self) -> BlockGen { BlockGen::new(ColumnGen::new(&self.sim)) } + #[allow(clippy::identity_conversion)] // TODO: Pending review in #587 + #[allow(clippy::or_fun_call)] // TODO: Pending review in #587 pub fn generate_chunk( &self, chunk_pos: Vec2, diff --git a/world/src/sim/diffusion.rs b/world/src/sim/diffusion.rs index 743b3c0d1d..c2cf051500 100644 --- a/world/src/sim/diffusion.rs +++ b/world/src/sim/diffusion.rs @@ -37,6 +37,7 @@ use rayon::prelude::*; implicit none */ +#[allow(clippy::too_many_arguments)] pub fn diffusion( nx: usize, ny: usize, @@ -404,6 +405,8 @@ pub fn diffusion( INTEGER n double precision a(n),b(n),c(n),r(n),u(n) */ +#[allow(clippy::assign_op_pattern)] // TODO: Pending review in #587 +#[allow(clippy::many_single_char_names)] pub fn tridag(a: &[f64], b: &[f64], c: &[f64], r: &[f64], u: &mut [f64], n: usize) { /* INTEGER j diff --git a/world/src/sim/erosion.rs b/world/src/sim/erosion.rs index 27d4f05014..35fbf72749 100644 --- a/world/src/sim/erosion.rs +++ b/world/src/sim/erosion.rs @@ -26,6 +26,7 @@ pub type Computex8 = [Compute; 8]; /// Compute the water flux at all chunks, given a list of chunk indices sorted /// by increasing height. +#[allow(clippy::into_iter_on_ref)] // TODO: Pending review in #587 pub fn get_drainage(newh: &[u32], downhill: &[isize], _boundary_len: usize) -> Box<[f32]> { // FIXME: Make the below work. For now, we just use constant flux. // Initially, flux is determined by rainfall. We currently treat this as the @@ -50,6 +51,7 @@ pub fn get_drainage(newh: &[u32], downhill: &[isize], _boundary_len: usize) -> B /// Compute the water flux at all chunks for multiple receivers, given a list of /// chunk indices sorted by increasing height and weights for each receiver. +#[allow(clippy::into_iter_on_ref)] // TODO: Pending review in #587 pub fn get_multi_drainage( mstack: &[u32], mrec: &[u8], @@ -216,6 +218,7 @@ impl RiverData { .unwrap_or(false) } + #[allow(clippy::len_zero)] // TODO: Pending review in #587 pub fn near_river(&self) -> bool { self.is_river() || self.neighbor_rivers.len() > 0 } pub fn near_water(&self) -> bool { self.near_river() || self.is_lake() || self.is_ocean() } @@ -224,6 +227,7 @@ impl RiverData { /// Draw rivers and assign them heights, widths, and velocities. Take some /// liberties with the constant factors etc. in order to make it more likely /// that we draw rivers at all. +#[allow(clippy::into_iter_on_ref)] // TODO: Pending review in #587 pub fn get_rivers, G: Float + Into>( newh: &[u32], water_alt: &[F], @@ -547,6 +551,7 @@ pub fn get_rivers, G: Float + Into>( /// Precompute the maximum slope at all points. /// /// TODO: See if allocating in advance is worthwhile. +#[allow(clippy::let_and_return)] // TODO: Pending review in #587 fn get_max_slope( h: &[Alt], rock_strength_nz: &(impl NoiseFn> + Sync), @@ -681,6 +686,10 @@ fn get_max_slope( /// Prediction in Geomorphology, Geophysical Monograph 135. /// Copyright 2003 by the American Geophysical Union /// 10.1029/135GM09 +#[allow(clippy::assign_op_pattern)] // TODO: Pending review in #587 +#[allow(clippy::collapsible_if)] // TODO: Pending review in #587 +#[allow(clippy::many_single_char_names)] +#[allow(clippy::too_many_arguments)] fn erode( // Height above sea level of topsoil h: &mut [Alt], @@ -1793,6 +1802,8 @@ pub fn fill_sinks( /// adjacency list). /// - The adjacency list (stored in a single vector), indexed by the second /// indirection vector. +#[allow(clippy::filter_next)] // TODO: Pending review in #587 +#[allow(clippy::into_iter_on_ref)] // TODO: Pending review in #587 pub fn get_lakes( h: impl Fn(usize) -> F, downhill: &mut [isize], @@ -2297,6 +2308,9 @@ pub fn mrec_downhill<'a>( /// * A bitmask representing which neighbors are downhill. /// * Stack order for multiple receivers (from top to bottom). /// * The weight for each receiver, for each node. +#[allow(clippy::into_iter_on_ref)] // TODO: Pending review in #587 +#[allow(clippy::too_many_arguments)] +#[allow(clippy::type_complexity)] // TODO: Pending review in #587 pub fn get_multi_rec>( h: impl Fn(usize) -> F + Sync, downhill: &[isize], @@ -2488,6 +2502,8 @@ pub fn get_multi_rec>( } /// Perform erosion n times. +#[allow(clippy::many_single_char_names)] +#[allow(clippy::too_many_arguments)] pub fn do_erosion( _max_uplift: f32, n_steps: usize, diff --git a/world/src/sim/map.rs b/world/src/sim/map.rs index aecea6880c..bed455e5aa 100644 --- a/world/src/sim/map.rs +++ b/world/src/sim/map.rs @@ -108,6 +108,9 @@ impl MapConfig { /// with 4 1-byte color components provided as (r, g, b, a). It is up /// to the caller to provide a function that translates this information /// into the correct format for a buffer and writes to it. + #[allow(clippy::if_same_then_else)] // TODO: Pending review in #587 + #[allow(clippy::identity_conversion)] // TODO: Pending review in #587 + #[allow(clippy::many_single_char_names)] pub fn generate( &self, sampler: &WorldSim, diff --git a/world/src/sim/mod.rs b/world/src/sim/mod.rs index 393a758184..1481717462 100644 --- a/world/src/sim/mod.rs +++ b/world/src/sim/mod.rs @@ -62,6 +62,7 @@ use vek::*; // signed floats anyway) but I think that is probably less important since I // don't think we actually cast a chunk id to float, just coordinates... could // be wrong though! +#[allow(clippy::identity_op)] // TODO: Pending review in #587 pub const WORLD_SIZE: Vec2 = Vec2 { x: 1024 * 1, y: 1024 * 1, @@ -229,6 +230,7 @@ pub type ModernMap = WorldMap_0_5_0; /// TODO: Consider using some naming convention to automatically change this /// with changing versions, or at least keep it in a constant somewhere that's /// easy to change. +#[allow(clippy::redundant_static_lifetimes)] // TODO: Pending review in #587 pub const DEFAULT_WORLD_MAP: &'static str = "world.map.veloren_0_6_0_0"; impl WorldFileLegacy { @@ -301,6 +303,9 @@ pub struct WorldSim { } impl WorldSim { + #[allow(clippy::if_same_then_else)] // TODO: Pending review in #587 + #[allow(clippy::let_and_return)] // TODO: Pending review in #587 + #[allow(clippy::redundant_closure)] // TODO: Pending review in #587 pub fn generate(seed: u32, opts: WorldOpts) -> Self { let mut rng = ChaChaRng::from_seed(seed_expan::rng_state(seed)); // NOTE: Change 1.0 to 4.0, while multiplying grid_size by 4, for a 4x @@ -1321,6 +1326,8 @@ impl WorldSim { } /// Prepare the world for simulation + #[allow(clippy::identity_conversion)] // TODO: Pending review in #587 + #[allow(clippy::option_map_unit_fn)] // TODO: Pending review in #587 pub fn seed_elements(&mut self) { let mut rng = self.rng.clone(); @@ -1489,6 +1496,7 @@ impl WorldSim { } } + #[allow(clippy::identity_conversion)] // TODO: Pending review in #587 pub fn get_gradient_approx(&self, chunk_pos: Vec2) -> Option { let a = self.get(chunk_pos)?; if let Some(downhill) = a.downhill { @@ -1507,6 +1515,7 @@ impl WorldSim { self.get_interpolated(wpos, |chunk| chunk.alt) } + #[allow(clippy::identity_conversion)] // TODO: Pending review in #587 pub fn get_wpos(&self, wpos: Vec2) -> Option<&SimChunk> { self.get( wpos.map2(Vec2::from(TerrainChunkSize::RECT_SIZE), |e, sz: u32| { @@ -1707,6 +1716,7 @@ impl WorldSim { Some(z0 + z1 + z2 + z3) } + #[allow(clippy::identity_conversion)] // TODO: Pending review in #587 pub fn get_nearest_path(&self, wpos: Vec2) -> Option<(f32, Vec2)> { let chunk_pos = wpos.map2(Vec2::from(TerrainChunkSize::RECT_SIZE), |e, sz: u32| { e.div_euclid(sz as i32) @@ -1811,6 +1821,8 @@ pub struct RegionInfo { } impl SimChunk { + #[allow(clippy::collapsible_if)] // TODO: Pending review in #587 + #[allow(clippy::if_same_then_else)] // TODO: Pending review in #587 fn generate(posi: usize, gen_ctx: &GenCtx, gen_cdf: &GenCdf) -> Self { let pos = uniform_idx_as_vec2(posi); let wposf = (pos * TerrainChunkSize::RECT_SIZE.map(|e| e as i32)).map(|e| e as f64); diff --git a/world/src/sim/util.rs b/world/src/sim/util.rs index add95e8ab0..36c6b970f6 100644 --- a/world/src/sim/util.rs +++ b/world/src/sim/util.rs @@ -217,6 +217,7 @@ pub fn uniform_noise( /// guarantees that for any point between the given chunk (on the top left) and /// its top-right/down-right/down neighbors, the twelve chunks surrounding this /// box (its "perimeter") are also inspected. +#[allow(clippy::identity_conversion)] // TODO: Pending review in #587 pub fn local_cells(posi: usize) -> impl Clone + Iterator { let pos = uniform_idx_as_vec2(posi); // NOTE: want to keep this such that the chunk index is in ascending order! diff --git a/world/src/site/dungeon/mod.rs b/world/src/site/dungeon/mod.rs index 4ab389312d..a805c6847e 100644 --- a/world/src/site/dungeon/mod.rs +++ b/world/src/site/dungeon/mod.rs @@ -55,6 +55,7 @@ const ALT_OFFSET: i32 = -2; const LEVELS: usize = 5; impl Dungeon { + #[allow(clippy::let_and_return)] // TODO: Pending review in #587 pub fn generate(wpos: Vec2, sim: Option<&WorldSim>, rng: &mut impl Rng) -> Self { let mut ctx = GenCtx { sim, rng }; let this = Self { @@ -82,6 +83,7 @@ impl Dungeon { pub fn radius(&self) -> f32 { 1200.0 } + #[allow(clippy::needless_update)] // TODO: Pending review in #587 pub fn spawn_rules(&self, wpos: Vec2) -> SpawnRules { SpawnRules { trees: wpos.distance_squared(self.origin) > 64i32.pow(2), @@ -148,6 +150,7 @@ impl Dungeon { } } + #[allow(clippy::or_fun_call)] // TODO: Pending review in #587 pub fn apply_supplement<'a>( &'a self, rng: &mut impl Rng, @@ -411,6 +414,7 @@ impl Floor { } } + #[allow(clippy::match_single_binding)] // TODO: Pending review in #587 pub fn apply_supplement( &self, rng: &mut impl Rng, diff --git a/world/src/site/settlement/building/archetype/house.rs b/world/src/site/settlement/building/archetype/house.rs index ebe671f544..a462551a9c 100644 --- a/world/src/site/settlement/building/archetype/house.rs +++ b/world/src/site/settlement/building/archetype/house.rs @@ -161,6 +161,8 @@ impl Archetype for House { (this, skel) } + #[allow(clippy::if_same_then_else)] // TODO: Pending review in #587 + #[allow(clippy::int_plus_one)] // TODO: Pending review in #587 fn draw( &self, dist: i32, diff --git a/world/src/site/settlement/building/archetype/keep.rs b/world/src/site/settlement/building/archetype/keep.rs index 6354413547..0d3d87dbe8 100644 --- a/world/src/site/settlement/building/archetype/keep.rs +++ b/world/src/site/settlement/building/archetype/keep.rs @@ -42,6 +42,7 @@ impl Archetype for Keep { (Self, skel) } + #[allow(clippy::if_same_then_else)] // TODO: Pending review in #587 fn draw( &self, dist: i32, diff --git a/world/src/site/settlement/building/skeleton.rs b/world/src/site/settlement/building/skeleton.rs index 4387a9e590..2014810b8f 100644 --- a/world/src/site/settlement/building/skeleton.rs +++ b/world/src/site/settlement/building/skeleton.rs @@ -72,6 +72,8 @@ impl Skeleton { bounds } + #[allow(clippy::logic_bug)] // TODO: Pending review in #587 + #[allow(clippy::or_fun_call)] // TODO: Pending review in #587 pub fn sample_closest( &self, pos: Vec2, diff --git a/world/src/site/settlement/mod.rs b/world/src/site/settlement/mod.rs index 23c2793e67..1d6c587c5a 100644 --- a/world/src/site/settlement/mod.rs +++ b/world/src/site/settlement/mod.rs @@ -151,6 +151,7 @@ impl Settlement { pub fn get_origin(&self) -> Vec2 { self.origin } /// Designate hazardous terrain based on world data + #[allow(clippy::block_in_if_condition_stmt)] // TODO: Pending review in #587 pub fn designate_from_world(&mut self, sim: &WorldSim, rng: &mut impl Rng) { let tile_radius = self.radius() as i32 / AREA_SIZE as i32; let hazard = self.land.hazard; @@ -207,6 +208,7 @@ impl Settlement { } } + #[allow(clippy::or_fun_call)] // TODO: Pending review in #587 pub fn place_paths(&mut self, rng: &mut impl Rng) { const PATH_COUNT: usize = 6; @@ -247,6 +249,7 @@ impl Settlement { } } + #[allow(clippy::option_map_unit_fn)] // TODO: Pending review in #587 pub fn place_town(&mut self, ctx: &mut GenCtx) { const PLOT_COUNT: usize = 3; @@ -465,6 +468,7 @@ impl Settlement { pub fn radius(&self) -> f32 { 1200.0 } + #[allow(clippy::needless_update)] // TODO: Pending review in #587 pub fn spawn_rules(&self, wpos: Vec2) -> SpawnRules { SpawnRules { trees: self @@ -477,6 +481,9 @@ impl Settlement { } } + #[allow(clippy::collapsible_if)] // TODO: Pending review in #587 + #[allow(clippy::identity_op)] // TODO: Pending review in #587 + #[allow(clippy::modulo_one)] // TODO: Pending review in #587 pub fn apply_to<'a>( &'a self, wpos2d: Vec2, @@ -756,6 +763,7 @@ impl Settlement { } } + #[allow(clippy::eval_order_dependence)] // TODO: Pending review in #587 pub fn apply_supplement<'a>( &'a self, rng: &mut impl Rng, @@ -1161,6 +1169,7 @@ impl Land { closed.into_iter().chain(open.into_iter()).collect() } + #[allow(clippy::option_map_unit_fn)] // TODO: Pending review in #587 fn write_path( &mut self, tiles: &[Vec2], diff --git a/world/src/util/fast_noise.rs b/world/src/util/fast_noise.rs index a40f02134a..43b595a015 100644 --- a/world/src/util/fast_noise.rs +++ b/world/src/util/fast_noise.rs @@ -13,6 +13,7 @@ impl FastNoise { } } + #[allow(clippy::excessive_precision)] // TODO: Pending review in #587 fn noise_at(&self, pos: Vec3) -> f32 { (self.noise.get(pos) & 4095) as f32 * 0.000244140625 } diff --git a/world/src/util/small_cache.rs b/world/src/util/small_cache.rs index 1d04e5d4e1..41d7475f32 100644 --- a/world/src/util/small_cache.rs +++ b/world/src/util/small_cache.rs @@ -27,6 +27,7 @@ impl Default for SmallCache { } } impl SmallCache { + #[allow(clippy::clone_on_copy)] // TODO: Pending review in #587 pub fn get) -> V>(&mut self, key: Vec2, f: F) -> &V { let idx = calc_idx(key) % CACHE_LEN; diff --git a/world/src/util/structure.rs b/world/src/util/structure.rs index 48429f3e65..b9a0a57cb2 100644 --- a/world/src/util/structure.rs +++ b/world/src/util/structure.rs @@ -13,6 +13,7 @@ pub struct StructureGen2d { pub type StructureField = (Vec2, u32); impl StructureGen2d { + #[allow(clippy::identity_op)] // TODO: Pending review in #587 pub fn new(seed: u32, freq: u32, spread: u32) -> Self { Self { freq, @@ -40,6 +41,7 @@ impl StructureGen2d { fn spread_mul(spread: u32) -> u32 { spread * 2 } #[inline] + #[allow(clippy::too_many_arguments)] fn index_to_sample_internal( freq: i32, freq_offset: i32,