Merge branch 'aweinstock/resolve-clippy-lints' into 'master'

Globally allow more clippy lints and reconfigure complexity to be less verbose

See merge request veloren/veloren!3052
This commit is contained in:
Marcel 2022-01-30 22:53:36 +00:00
commit 72e270368d
94 changed files with 50 additions and 136 deletions

22
clippy.toml Normal file
View File

@ -0,0 +1,22 @@
# TODO: do we want to use `#[deny(clippy::disallowed_method)]` to disallow all unwraps (possibly only in non-test code)?
#disallowed-methods = [
# "std::option::Option::unwrap",
# "std::result::Result::unwrap",
#]
# The `too_many_arguments`, `many_single_char_names`, and `type_complexity`
# lints give sufficiently many false positives that they're worth disabling
# globally via raising their thresholds.
# `too_many_arguments` often flags `new` methods on structs that legitimately
# ought to have many parameters
too-many-arguments-threshold = 15
# `many_single_char_names` often triggers for geometry or physics code with an
# associated diagram, where the short names are points in the diagram.
single-char-binding-names-threshold = 8
# `type_complexity` often triggers for the RHS of an associated type: it's
# telling you that a type is complicated enough to need a name, at the point
# where you're giving it a name.
type-complexity-threshold = 750

View File

@ -190,7 +190,6 @@ pub struct QuadPngEncoding<const RESOLUTION_DIVIDER: u32>();
impl<const N: u32> VoxelImageEncoding for QuadPngEncoding<N> {
type Output = CompressedData<(Vec<u8>, [usize; 3])>;
#[allow(clippy::type_complexity)]
type Workspace = (
ImageBuffer<image::Luma<u8>, Vec<u8>>,
ImageBuffer<image::Luma<u8>, Vec<u8>>,
@ -464,9 +463,7 @@ impl<const N: u32> VoxelImageDecoding for QuadPngEncoding<N> {
pub struct TriPngEncoding<const AVERAGE_PALETTE: bool>();
impl<const AVERAGE_PALETTE: bool> VoxelImageEncoding for TriPngEncoding<AVERAGE_PALETTE> {
#[allow(clippy::type_complexity)]
type Output = CompressedData<(Vec<u8>, Vec<Rgb<u8>>, [usize; 3])>;
#[allow(clippy::type_complexity)]
type Workspace = (
ImageBuffer<image::Luma<u8>, Vec<u8>>,
ImageBuffer<image::Luma<u8>, Vec<u8>>,

View File

@ -137,7 +137,7 @@ pub struct CompSyncPackage<P: CompPacket> {
}
impl<P: CompPacket> CompSyncPackage<P> {
#[allow(clippy::new_without_default)] // TODO: Pending review in #587
#[allow(clippy::new_without_default)]
pub fn new() -> Self {
Self {
comp_updates: Vec::new(),

View File

@ -176,7 +176,6 @@ impl Attack {
1.0 - (1.0 - damage_reduction) * (1.0 - block_reduction)
}
#[allow(clippy::too_many_arguments)]
pub fn apply_attack(
&self,
attacker: Option<AttackerInfo>,

View File

@ -459,7 +459,6 @@ impl Timer {
}
}
#[allow(clippy::type_complexity)]
#[derive(Clone, Debug)]
pub struct Agent {
pub rtsim_controller: RtSimController,
@ -533,7 +532,6 @@ impl Agent {
self
}
#[allow(clippy::type_complexity)]
#[must_use]
pub fn with_position_pid_controller(
mut self,

View File

@ -155,7 +155,6 @@ impl GroupManager {
// Add someone to a group
// Also used to create new groups
#[allow(clippy::too_many_arguments)] // TODO: Pending review in #587
pub fn add_group_member(
&mut self,
leader: specs::Entity,
@ -257,7 +256,6 @@ impl GroupManager {
});
}
#[allow(clippy::too_many_arguments)] // TODO: Pending review in #587
pub fn new_pet(
&mut self,
pet: specs::Entity,
@ -336,7 +334,6 @@ impl GroupManager {
// Remove someone from a group if they are in one
// Don't need to check if they are in a group before calling this
// Also removes pets (ie call this if the pet no longer exists)
#[allow(clippy::too_many_arguments)] // TODO: Pending review in #587
fn remove_from_group(
&mut self,
member: specs::Entity,

View File

@ -107,7 +107,6 @@ pub enum ServerEvent {
},
UpdateCharacterData {
entity: EcsEntity,
#[allow(clippy::type_complexity)]
components: (
comp::Body,
comp::Stats,

View File

@ -113,7 +113,7 @@ impl Segment {
pub struct DynaUnionizer<V: Vox>(Vec<(Dyna<V, ()>, Vec3<i32>)>);
impl<V: Vox + Copy> DynaUnionizer<V> {
#[allow(clippy::new_without_default)] // TODO: Pending review in #587
#[allow(clippy::new_without_default)]
pub fn new() -> Self { DynaUnionizer(Vec::new()) }
#[must_use]

View File

@ -24,7 +24,6 @@ pub struct Recipe {
pub craft_sprite: Option<SpriteKind>,
}
#[allow(clippy::type_complexity)]
impl Recipe {
/// Perform a recipe, returning a list of missing items on failure
pub fn craft_simple(

View File

@ -13,6 +13,7 @@ pub enum Event {
}
/// Region consisting of a bitset of entities within it
#[derive(Default)]
pub struct Region {
// Use specs bitset for simplicity (and joinability)
bitset: BitSet,
@ -23,14 +24,6 @@ pub struct Region {
events: Vec<Event>,
}
impl Region {
fn new() -> Self {
Self {
bitset: BitSet::new(),
neighbors: [None; 8],
events: Vec::new(),
}
}
/// Checks if the region contains no entities and no events
fn removable(&self) -> bool { self.bitset.is_empty() && self.events.is_empty() }
@ -70,6 +63,7 @@ const NEIGHBOR_OFFSETS: [Vec2<i32>; 8] = [
Vec2::new(1, 1),
];
#[derive(Default)]
// TODO generic region size (16x16 for now)
// TODO compare to sweep and prune approach
/// A region system that tracks where entities are
@ -87,20 +81,11 @@ pub struct RegionMap {
// (region, entity)
entities_to_remove: Vec<(usize, u32)>,
// Track the current tick, used to enable not checking everything every tick
// rate is dependent on the rate the caller calls region_manager.tick()
tick: u64,
}
impl RegionMap {
#[allow(clippy::new_without_default)] // TODO: Pending review in #587
pub fn new() -> Self {
Self {
regions: IndexMap::default(),
tracked_entities: BitSet::new(),
entities_to_move: Vec::new(),
entities_to_remove: Vec::new(),
// rate is dependent on the rate the caller calls region_manager.tick()
tick: 0,
}
}
pub fn new() -> Self { Self::default() }
// TODO maintain within a system?
// TODO special case large entities
@ -269,7 +254,7 @@ impl RegionMap {
/// Adds a new region
/// Returns the index of the region in the index map
fn insert(&mut self, key: Vec2<i32>) -> usize {
let (index, old_region) = self.regions.insert_full(key, Region::new());
let (index, old_region) = self.regions.insert_full(key, Region::default());
if old_region.is_some() {
panic!("Inserted a region that already exists!!!(this should never need to occur");
}

View File

@ -9,20 +9,22 @@ pub struct Spiral2d {
}
impl Spiral2d {
#[allow(clippy::new_without_default)] // TODO: Pending review in #587
#[allow(clippy::new_without_default)]
/// Creates a new spiral starting at the origin
pub fn new() -> Self { Self { layer: 0, i: 0 } }
/// Creates an iterator over points in a spiral starting at the origin and
/// going out to some radius
pub fn radius(self, radius: i32) -> impl Iterator<Item = Vec2<i32>> {
self.take((radius * 2 + 1).pow(2) as usize)
pub fn with_radius(radius: i32) -> impl Iterator<Item = Vec2<i32>> {
Self::new()
.take((radius * 2 + 1).pow(2) as usize)
.filter(move |pos| pos.magnitude_squared() < (radius + 1).pow(2))
}
/// Creates an iterator over points in the edge of a circle of some radius
pub fn edge_radius(self, radius: i32) -> impl Iterator<Item = Vec2<i32>> {
self.take((radius * 2 + 1).pow(2) as usize)
pub fn with_edge_radius(radius: i32) -> impl Iterator<Item = Vec2<i32>> {
Self::new()
.take((radius * 2 + 1).pow(2) as usize)
.filter(move |pos| pos.magnitude_squared() < (radius + 1).pow(2))
.filter(move |pos| pos.magnitude_squared() >= radius.pow(2))
}

View File

@ -85,7 +85,7 @@ impl CharacterBehavior for Data {
// 1 added to make range correct, too lazy to add 1 to both variables above
let radius = radius + 1;
// Creates a spiral iterator for the newly achieved radius
let spiral = Spiral2d::new().edge_radius(radius);
let spiral = Spiral2d::with_edge_radius(radius);
for point in spiral {
// If square is not sparse, generate sprite
if !thread_rng().gen_bool(self.static_data.sparseness) {

View File

@ -245,7 +245,6 @@ impl<V, S: RectVolSize, M: Clone> Iterator for ChonkIterHelper<V, S, M> {
}
}
#[allow(clippy::type_complexity)] // TODO: Pending review in #587
pub struct ChonkPosIter<V, S: RectVolSize, M: Clone> {
outer: ChonkIterHelper<V, S, M>,
opt_inner: Option<(i32, ChunkPosIter<V, SubChunkSize<S>, M>)>,

View File

@ -91,7 +91,6 @@ pub struct TerrainChunkMeta {
contains_dungeon: bool,
}
#[allow(clippy::too_many_arguments)]
impl TerrainChunkMeta {
pub fn new(
name: Option<String>,

View File

@ -98,7 +98,6 @@ pub trait ReadVol: BaseVol {
/// Get a reference to the voxel at the provided position in the volume.
fn get(&self, pos: Vec3<i32>) -> Result<&Self::Vox, Self::Error>;
#[allow(clippy::type_complexity)] // TODO: Pending review in #587
/// NOTE: By default, this ray will simply run from `from` to `to` without
/// stopping. To make something interesting happen, call `until` or
/// `for_each`.

View File

@ -310,7 +310,6 @@ impl<'a> System<'a> for Sys {
/// Assumes upright cylinder
/// See page 12 of https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.396.7952&rep=rep1&type=pdf
#[allow(clippy::too_many_arguments)]
fn sphere_wedge_cylinder_collision(
// Values for spherical wedge
real_pos: Vec3<f32>,

View File

@ -57,7 +57,6 @@ pub struct ReadData<'a> {
pub struct Sys;
impl<'a> System<'a> for Sys {
#[allow(clippy::type_complexity)]
type SystemData = (
ReadData<'a>,
WriteStorage<'a, CharacterState>,

View File

@ -15,7 +15,6 @@ use vek::*;
#[derive(Default)]
pub struct Sys;
impl<'a> System<'a> for Sys {
#[allow(clippy::type_complexity)]
type SystemData = (
Read<'a, UidAllocator>,
Entities<'a>,

View File

@ -41,7 +41,6 @@ fn fluid_density(height: f32, fluid: &Fluid) -> Density {
Density(fluid.density().0 * immersion + AIR_DENSITY * (1.0 - immersion))
}
#[allow(clippy::too_many_arguments)]
fn integrate_forces(
dt: &DeltaTime,
mut vel: Vel,
@ -1319,7 +1318,7 @@ impl<'a> System<'a> for Sys {
}
}
#[allow(clippy::too_many_arguments, clippy::too_many_lines)]
#[allow(clippy::too_many_lines)]
fn box_voxel_collision<'a, T: BaseVol<Vox = Block> + ReadVol>(
cylinder: (f32, f32, f32), // effective collision cylinder
terrain: &'a T,
@ -1944,8 +1943,6 @@ fn projection_between(c0: ColliderContext, c1: ColliderContext) -> (Vec2<f32>, f
/// unspecified pair of points that sit on the line segments will be chosen.
fn closest_points(n: LineSegment2<f32>, m: LineSegment2<f32>) -> (Vec2<f32>, Vec2<f32>) {
// TODO: Rewrite this to something reasonable, if you have faith
#![allow(clippy::many_single_char_names)]
let a = n.start;
let b = n.end - n.start;
let c = m.start;

View File

@ -34,7 +34,6 @@ pub struct ReadData<'a> {
#[derive(Default)]
pub struct Sys;
impl<'a> System<'a> for Sys {
#[allow(clippy::type_complexity)]
type SystemData = (
ReadData<'a>,
WriteStorage<'a, Stats>,

View File

@ -760,7 +760,6 @@ impl Participant {
}
impl Stream {
#[allow(clippy::too_many_arguments)]
pub(crate) fn new(
local_pid: Pid,
remote_pid: Pid,

View File

@ -85,7 +85,6 @@ impl BParticipant {
const TICK_TIME: Duration = Duration::from_millis(Self::TICK_TIME_MS);
const TICK_TIME_MS: u64 = 5;
#[allow(clippy::type_complexity)]
pub(crate) fn new(
local_pid: Pid,
remote_pid: Pid,
@ -223,7 +222,6 @@ impl BParticipant {
}
//TODO: local stream_cid: HashMap<Sid, Cid> to know the respective protocol
#[allow(clippy::too_many_arguments)]
async fn send_mgr(
&self,
mut a2b_open_stream_r: mpsc::UnboundedReceiver<A2bStreamOpen>,
@ -781,7 +779,6 @@ mod tests {
task::JoinHandle,
};
#[allow(clippy::type_complexity)]
fn mock_bparticipant() -> (
Arc<Runtime>,
mpsc::UnboundedSender<A2bStreamOpen>,

View File

@ -44,7 +44,6 @@ impl Component for Client {
}
impl Client {
#[allow(clippy::too_many_arguments)]
pub(crate) fn new(
client_type: ClientType,
participant: Participant,

View File

@ -30,7 +30,6 @@ pub fn handle_initialize_character(
server.state.initialize_character_data(entity, character_id);
}
#[allow(clippy::type_complexity)]
pub fn handle_loaded_character_data(
server: &mut Server,
entity: EcsEntity,
@ -42,7 +41,6 @@ pub fn handle_loaded_character_data(
sys::subscription::initialize_region_subscription(server.state.ecs(), entity);
}
#[allow(clippy::too_many_arguments)] // TODO: Pending review in #587
pub fn handle_create_npc(
server: &mut Server,
pos: Pos,
@ -161,7 +159,6 @@ pub fn handle_create_ship(
entity.build();
}
#[allow(clippy::too_many_arguments)]
pub fn handle_shoot(
server: &mut Server,
entity: EcsEntity,

View File

@ -16,7 +16,6 @@ use std::sync::Arc;
#[derive(Default)]
pub struct Sys;
impl<'a> System<'a> for Sys {
#[allow(clippy::type_complexity)]
type SystemData = (
Read<'a, Time>,
Read<'a, DeltaTime>,

View File

@ -10,7 +10,6 @@ use specs::{Entities, Read, ReadExpect, ReadStorage, WriteExpect};
#[derive(Default)]
pub struct Sys;
impl<'a> System<'a> for Sys {
#[allow(clippy::type_complexity)]
type SystemData = (
Read<'a, EventBus<ServerEvent>>,
WriteExpect<'a, RtSim>,

View File

@ -42,7 +42,6 @@ pub trait StateExt {
/// Updates a component associated with the entity based on the `Effect`
fn apply_effect(&self, entity: EcsEntity, effect: Effect, source: Option<Uid>);
/// Build a non-player character
#[allow(clippy::too_many_arguments)]
fn create_npc(
&mut self,
pos: comp::Pos,

View File

@ -66,7 +66,6 @@ use vek::*;
#[derive(Default)]
pub struct Sys;
impl<'a> System<'a> for Sys {
#[allow(clippy::type_complexity)]
type SystemData = (
ReadData<'a>,
Write<'a, EventBus<ServerEvent>>,
@ -2178,7 +2177,6 @@ impl<'a> AgentData<'a> {
/// multiplies the movement speed by a value less than 1.0.
/// A `None` value implies a multiplier of 1.0.
/// Returns `false` if the pathfinding algorithm fails to return a path
#[allow(clippy::too_many_arguments)]
fn path_toward_target(
&self,
agent: &mut Agent,

View File

@ -11,7 +11,6 @@ use std::time::Instant;
#[derive(Default)]
pub struct Sys;
impl<'a> System<'a> for Sys {
#[allow(clippy::type_complexity)]
type SystemData = (
Option<Entities<'a>>,
ReadExpect<'a, HwStats>,

View File

@ -18,7 +18,6 @@ use std::sync::atomic::Ordering;
use tracing::{debug, warn};
impl Sys {
#[allow(clippy::too_many_arguments)]
fn handle_client_character_screen_msg(
server_emitter: &mut common::event::Emitter<'_, ServerEvent>,
entity: specs::Entity,
@ -186,7 +185,6 @@ impl Sys {
#[derive(Default)]
pub struct Sys;
impl<'a> System<'a> for Sys {
#[allow(clippy::type_complexity)]
type SystemData = (
Entities<'a>,
Read<'a, EventBus<ServerEvent>>,

View File

@ -67,7 +67,6 @@ impl Sys {
#[derive(Default)]
pub struct Sys;
impl<'a> System<'a> for Sys {
#[allow(clippy::type_complexity)]
type SystemData = (
Entities<'a>,
Read<'a, EventBus<ServerEvent>>,

View File

@ -22,7 +22,6 @@ impl Sys {
#[derive(Default)]
pub struct Sys;
impl<'a> System<'a> for Sys {
#[allow(clippy::type_complexity)]
type SystemData = (
Entities<'a>,
Read<'a, EventBus<ServerEvent>>,

View File

@ -15,7 +15,6 @@ use tracing::{debug, trace};
#[derive(Default)]
pub struct Sys;
impl<'a> System<'a> for Sys {
#[allow(clippy::type_complexity)]
type SystemData = (
Entities<'a>,
ReadExpect<'a, TerrainGrid>,

View File

@ -12,7 +12,6 @@ use specs::{Entities, Join, Read, ReadStorage, WriteStorage};
#[derive(Default)]
pub struct Sys;
impl<'a> System<'a> for Sys {
#[allow(clippy::type_complexity)]
type SystemData = (
Entities<'a>,
Read<'a, DeltaTime>,

View File

@ -14,7 +14,6 @@ use specs::{Join, ReadStorage, Write, WriteExpect};
pub struct Sys;
impl<'a> System<'a> for Sys {
#[allow(clippy::type_complexity)]
type SystemData = (
ReadStorage<'a, Alignment>,
ReadStorage<'a, Body>,

View File

@ -12,7 +12,6 @@ use specs::{
#[derive(Default)]
pub struct Sys;
impl<'a> System<'a> for Sys {
#[allow(clippy::type_complexity)]
type SystemData = (
Entities<'a>,
ReadExpect<'a, TerrainGrid>,

View File

@ -22,7 +22,6 @@ use vek::*;
#[derive(Default)]
pub struct Sys;
impl<'a> System<'a> for Sys {
#[allow(clippy::type_complexity)]
type SystemData = (
Entities<'a>,
ReadExpect<'a, RegionMap>,

View File

@ -106,7 +106,7 @@ impl LazyTerrainMessage {
#[derive(Default)]
pub struct Sys;
impl<'a> System<'a> for Sys {
#[allow(clippy::type_complexity)] // TODO: Pending review in #587
#[allow(clippy::type_complexity)]
type SystemData = (
Read<'a, EventBus<ServerEvent>>,
Read<'a, Tick>,

View File

@ -11,7 +11,6 @@ use specs::{Join, Read, ReadExpect, ReadStorage};
#[derive(Default)]
pub struct Sys;
impl<'a> System<'a> for Sys {
#[allow(clippy::type_complexity)]
type SystemData = (
ReadExpect<'a, TerrainGrid>,
Read<'a, TerrainChanges>,

View File

@ -15,7 +15,6 @@ const NOTIFY_TIME: f64 = 10.0;
#[derive(Default)]
pub struct Sys;
impl<'a> System<'a> for Sys {
#[allow(clippy::type_complexity)]
type SystemData = (
Entities<'a>,
ReadStorage<'a, Pos>,

View File

@ -68,7 +68,6 @@ pub fn dispatch_actions(system_data: &mut WiringData) {
)
}
#[allow(clippy::too_many_arguments)]
fn dispatch_action(
entity: Entity,
inputs: &HashMap<String, f32>,
@ -123,7 +122,6 @@ fn dispatch_action_spawn_projectile(
});
}
#[allow(clippy::too_many_arguments)]
fn dispatch_action_set_light(
inputs: &HashMap<String, f32>,
r: &OutputFormula,

View File

@ -11,7 +11,6 @@ use core::f32::consts::PI;
pub struct AlphaAnimation;
impl Animation for AlphaAnimation {
#[allow(clippy::type_complexity)]
type Dependency<'a> = (
(Option<ToolKind>, Option<&'a AbilitySpec>),
(Option<ToolKind>, Option<&'a AbilitySpec>),

View File

@ -11,7 +11,6 @@ use core::f32::consts::PI;
pub struct BeamAnimation;
impl Animation for BeamAnimation {
#[allow(clippy::type_complexity)]
type Dependency<'a> = (
(Option<ToolKind>, Option<&'a AbilitySpec>),
(Option<ToolKind>, Option<&'a AbilitySpec>),

View File

@ -11,7 +11,6 @@ use std::f32::consts::PI;
pub struct BetaAnimation;
impl Animation for BetaAnimation {
#[allow(clippy::type_complexity)]
type Dependency<'a> = (
(Option<ToolKind>, Option<&'a AbilitySpec>),
(Option<ToolKind>, Option<&'a AbilitySpec>),

View File

@ -11,7 +11,6 @@ use core::f32::consts::PI;
pub struct ChargeMeleeAnimation;
impl Animation for ChargeMeleeAnimation {
#[allow(clippy::type_complexity)]
type Dependency<'a> = (
(Option<ToolKind>, Option<&'a AbilitySpec>),
(Option<ToolKind>, Option<&'a AbilitySpec>),

View File

@ -11,7 +11,6 @@ use core::f32::consts::PI;
pub struct DashAnimation;
impl Animation for DashAnimation {
#[allow(clippy::type_complexity)]
type Dependency<'a> = (
(Option<ToolKind>, Option<&'a AbilitySpec>),
(Option<ToolKind>, Option<&'a AbilitySpec>),

View File

@ -11,7 +11,6 @@ use core::f32::consts::PI;
pub struct SelfBuffAnimation;
impl Animation for SelfBuffAnimation {
#[allow(clippy::type_complexity)]
type Dependency<'a> = (
(Option<ToolKind>, Option<&'a AbilitySpec>),
(Option<ToolKind>, Option<&'a AbilitySpec>),

View File

@ -11,7 +11,6 @@ use core::f32::consts::PI;
pub struct StunnedAnimation;
impl Animation for StunnedAnimation {
#[allow(clippy::type_complexity)]
type Dependency<'a> = (
(Option<ToolKind>, Option<&'a AbilitySpec>),
Vec3<f32>,

View File

@ -11,7 +11,6 @@ use core::f32::consts::PI;
pub struct SummonAnimation;
impl Animation for SummonAnimation {
#[allow(clippy::type_complexity)]
type Dependency<'a> = (
(Option<ToolKind>, Option<&'a AbilitySpec>),
(Option<ToolKind>, Option<&'a AbilitySpec>),

View File

@ -8,7 +8,6 @@ use core::{f32::consts::PI, ops::Mul};
pub struct WieldAnimation;
impl Animation for WieldAnimation {
#[allow(clippy::type_complexity)]
type Dependency<'a> = (
(Option<ToolKind>, Option<&'a AbilitySpec>),
(Option<ToolKind>, Option<&'a AbilitySpec>),

View File

@ -11,7 +11,6 @@ use std::f32::consts::PI;
pub struct BeamAnimation;
impl Animation for BeamAnimation {
#[allow(clippy::type_complexity)]
type Dependency<'a> = (
Option<AbilityInfo>,
(Option<Hands>, Option<Hands>),

View File

@ -9,7 +9,6 @@ use std::ops::Mul;
pub struct IdleAnimation;
impl Animation for IdleAnimation {
#[allow(clippy::type_complexity)]
type Dependency<'a> = (
Option<ToolKind>,
Option<ToolKind>,

View File

@ -7,7 +7,6 @@ use core::f32::consts::PI;
pub struct JumpAnimation;
impl Animation for JumpAnimation {
#[allow(clippy::type_complexity)]
type Dependency<'a> = (
Option<ToolKind>,
Option<ToolKind>,

View File

@ -8,7 +8,6 @@ use std::{f32::consts::PI, ops::Mul};
pub struct MountAnimation;
impl Animation for MountAnimation {
#[allow(clippy::type_complexity)]
type Dependency<'a> = (
Option<ToolKind>,
Option<ToolKind>,

View File

@ -12,7 +12,6 @@ use core::f32::consts::PI;
pub struct RepeaterAnimation;
impl Animation for RepeaterAnimation {
#[allow(clippy::type_complexity)]
type Dependency<'a> = (
Option<AbilityInfo>,
(Option<Hands>, Option<Hands>),

View File

@ -13,7 +13,6 @@ pub struct Input {
pub struct ShockwaveAnimation;
impl Animation for ShockwaveAnimation {
#[allow(clippy::type_complexity)]
type Dependency<'a> = (
Option<AbilityInfo>,
(Option<Hands>, Option<Hands>),

View File

@ -8,7 +8,6 @@ use core::{f32::consts::PI, ops::Mul};
pub struct SneakWieldAnimation;
impl Animation for SneakWieldAnimation {
#[allow(clippy::type_complexity)]
type Dependency<'a> = (
Option<ToolKind>,
Option<ToolKind>,

View File

@ -9,7 +9,6 @@ use std::ops::Mul;
pub struct StandAnimation;
impl Animation for StandAnimation {
#[allow(clippy::type_complexity)]
type Dependency<'a> = (
Option<ToolKind>,
Option<ToolKind>,

View File

@ -8,7 +8,6 @@ use core::{f32::consts::PI, ops::Mul};
pub struct SwimWieldAnimation;
impl Animation for SwimWieldAnimation {
#[allow(clippy::type_complexity)]
type Dependency<'a> = (
Option<ToolKind>,
Option<ToolKind>,

View File

@ -1,2 +0,0 @@
# Because 7 is just very low, it corresponds to a 6-argument method.
too-many-arguments-threshold = 10

View File

@ -14,7 +14,6 @@ pub(crate) struct LocalizationStats {
pub(crate) errors: usize,
}
#[allow(clippy::type_complexity)]
pub(crate) struct LocalizationAnalysis {
language_identifier: String,
pub(crate) data: HashMap<Option<LocalizationState>, Vec<(PathBuf, String, Option<git2::Oid>)>>,

View File

@ -15,7 +15,6 @@ pub const HP_ACCUMULATETIME: f32 = 1.0;
#[derive(Default)]
pub struct Sys;
impl<'a> System<'a> for Sys {
#[allow(clippy::type_complexity)]
type SystemData = (
Entities<'a>,
Read<'a, PlayerEntity>,

View File

@ -12,7 +12,6 @@ use vek::*;
#[derive(Default)]
pub struct Sys;
impl<'a> System<'a> for Sys {
#[allow(clippy::type_complexity)]
type SystemData = (
Entities<'a>,
Read<'a, DeltaTime>,

View File

@ -583,7 +583,7 @@ pub struct Bag<'a> {
}
impl<'a> Bag<'a> {
#[allow(clippy::too_many_arguments)] // TODO: Pending review in #587
#[allow(clippy::too_many_arguments)]
pub fn new(
client: &'a Client,
global_state: &'a GlobalState,

View File

@ -66,7 +66,6 @@ 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,

View File

@ -105,7 +105,7 @@ pub struct Crafting<'a> {
tooltip_manager: &'a mut TooltipManager,
show: &'a mut Show,
}
#[allow(clippy::too_many_arguments)]
impl<'a> Crafting<'a> {
pub fn new(
client: &'a Client,

View File

@ -89,7 +89,6 @@ pub struct Group<'a> {
}
impl<'a> Group<'a> {
#[allow(clippy::too_many_arguments)] // TODO: Pending review in #587
pub fn new(
show: &'a mut Show,
client: &'a Client,

View File

@ -65,7 +65,6 @@ pub struct LootScroller<'a> {
common: widget::CommonBuilder,
}
impl<'a> LootScroller<'a> {
#[allow(clippy::too_many_arguments)] // TODO: Pending review in #587
pub fn new(
new_messages: &'a mut VecDeque<LootMessage>,
client: &'a Client,

View File

@ -114,7 +114,6 @@ pub struct Map<'a> {
map_drag: Vec2<f64>,
}
impl<'a> Map<'a> {
#[allow(clippy::too_many_arguments)] // TODO: Pending review in #587
pub fn new(
show: &'a Show,
client: &'a Client,

View File

@ -267,7 +267,7 @@ pub struct Skillbar<'a> {
}
impl<'a> Skillbar<'a> {
#[allow(clippy::too_many_arguments)] // TODO: Pending review in #587
#[allow(clippy::too_many_arguments)]
pub fn new(
client: &'a Client,
global_state: &'a GlobalState,

View File

@ -1,6 +1,6 @@
#![deny(unsafe_code)]
#![allow(incomplete_features)]
#![allow(clippy::option_map_unit_fn)]
#![allow(clippy::identity_op, clippy::option_map_unit_fn)]
#![deny(clippy::clone_on_ref_ptr)]
#![feature(
array_methods,

View File

@ -51,7 +51,6 @@ impl Screen {
}
}
#[allow(clippy::too_many_arguments)]
pub(super) fn view(
&mut self,
fonts: &Fonts,

View File

@ -15,8 +15,8 @@ impl<V: Vertex> Clone for Mesh<V> {
}
impl<V: Vertex> Mesh<V> {
#[allow(clippy::new_without_default)]
/// Create a new `Mesh`.
#[allow(clippy::new_without_default)] // TODO: Pending review in #587
pub fn new() -> Self { Self { verts: Vec::new() } }
/// Clear vertices, allows reusing allocated memory of the underlying Vec.

View File

@ -10,7 +10,6 @@ pub struct Vertex {
}
impl Vertex {
#[allow(clippy::identity_op)] // TODO: Pending review in #587
pub fn new(pos: Vec3<f32>, norm: Vec3<f32>) -> Self {
let (norm_axis, norm_dir) = norm
.as_slice()

View File

@ -81,7 +81,7 @@ pub struct Shadow {
impl Globals {
/// Create global consts from the provided parameters.
#[allow(clippy::too_many_arguments)] // TODO: Pending review in #587
#[allow(clippy::too_many_arguments)]
pub fn new(
view_mat: Mat4<f32>,
proj_mat: Mat4<f32>,

View File

@ -11,7 +11,6 @@ pub struct Vertex {
}
impl Vertex {
#[allow(clippy::identity_op)] // TODO: Pending review in #587
/// NOTE: meta is true when the terrain vertex is touching water.
pub fn new(atlas_pos: Vec2<u16>, pos: Vec3<f32>, norm: Vec3<f32>, meta: bool) -> Self {
const EXTRA_NEG_Z: f32 = 32768.0;
@ -97,7 +96,6 @@ impl Vertex {
]
}
#[allow(clippy::identity_op)]
pub fn make_col_light_figure(
// 0 to 31
light: u8,

View File

@ -98,7 +98,6 @@ struct Shadow {
/// 1. Only interface pipelines created
/// 2. All of the pipelines have been created
#[allow(clippy::large_enum_variant)] // They are both pretty large
#[allow(clippy::type_complexity)]
enum State {
// NOTE: this is used as a transient placeholder for moving things out of State temporarily
Nothing,

View File

@ -818,7 +818,6 @@ pub(super) fn initial_create_pipelines(
/// Use this to recreate all the pipelines in the background.
/// TODO: report progress
/// NOTE: this tries to use all the CPU cores to complete as soon as possible
#[allow(clippy::type_complexity)]
pub(super) fn recreate_pipelines(
device: Arc<wgpu::Device>,
immutable_layouts: Arc<ImmutableLayouts>,

View File

@ -151,7 +151,6 @@ pub struct DebugShapeId(pub u64);
pub struct Debug {
next_shape_id: DebugShapeId,
pending_shapes: HashMap<DebugShapeId, DebugShape>,
#[allow(clippy::type_complexity)]
pending_locals: HashMap<DebugShapeId, ([f32; 4], [f32; 4], [f32; 4])>,
pending_deletes: HashSet<DebugShapeId>,
models: HashMap<DebugShapeId, (Model<DebugVertex>, Bound<Consts<DebugLocals>>)>,

View File

@ -280,7 +280,6 @@ impl CharacterCacheKey {
}
}
#[allow(clippy::type_complexity)] // TODO: Pending review in #587
pub struct FigureModelCache<Skel = anim::character::CharacterSkeleton>
where
Skel: Skeleton,
@ -295,7 +294,7 @@ impl<Skel: Skeleton> FigureModelCache<Skel>
where
Skel::Body: BodySpec + Eq + Hash,
{
#[allow(clippy::new_without_default)] // TODO: Pending review in #587
#[allow(clippy::new_without_default)]
pub fn new() -> Self {
// NOTE: It might be better to bubble this error up rather than panicking.
let manifests = <Skel::Body as BodySpec>::load_spec().unwrap();

View File

@ -5407,7 +5407,6 @@ impl FigureMgr {
}
}
#[allow(clippy::too_many_arguments)] // TODO: Pending review in #587
fn get_model_for_render(
&self,
tick: u64,

View File

@ -44,7 +44,6 @@ impl<T> Target<T> {
pub const MAX_TARGET_RANGE: f32 = 300.0;
/// Calculate what the cursor is pointing at within the 3d scene
#[allow(clippy::type_complexity)]
pub(super) fn targets_under_cursor(
client: &Client,
cam_pos: Vec3<f32>,

View File

@ -149,7 +149,6 @@ pub struct GraphicCache {
// Stores the location of graphics rendered at a particular resolution and cached on the cpu
cache_map: HashMap<Parameters, CachedDetails>,
#[allow(clippy::type_complexity)]
keyed_jobs: KeyedJobs<(Id, Vec2<u16>), Option<(RgbaImage, Option<Rgba<f32>>)>>,
}
impl GraphicCache {
@ -405,7 +404,6 @@ impl GraphicCache {
}
// Draw a graphic at the specified dimensions
#[allow(clippy::type_complexity)]
fn draw_graphic(
graphic_map: &GraphicMap,
graphic_id: Id,

View File

@ -524,7 +524,6 @@ where
self
}
#[allow(clippy::too_many_arguments)] // TODO: Pending review in #587
fn new(
slot_key: K,
empty_slot: image::Id,

View File

@ -747,8 +747,7 @@ fn main() {
let mut total_timings: BTreeMap<&str, f32> = BTreeMap::new();
let mut count = 0;
let mut volgrid = VolGrid2d::new().unwrap();
for (i, spiralpos) in Spiral2d::new()
.radius(RADIUS)
for (i, spiralpos) in Spiral2d::with_radius(RADIUS)
.map(|v| v + sitepos.as_())
.enumerate()
{

View File

@ -186,7 +186,6 @@ impl<'a> BlockGen<'a> {
.or_else(|| {
// Rocks
if (height + 2.5 - wposf.z as f32).div(7.5).abs().powi(2) < rock {
#[allow(clippy::identity_op)]
let field0 = RandomField::new(world.seed + 0);
let field1 = RandomField::new(world.seed + 1);
let field2 = RandomField::new(world.seed + 2);

View File

@ -39,7 +39,6 @@ pub struct CaveInfo {
pub name: String,
}
#[allow(clippy::type_complexity)] // TODO: Pending review in #587
#[derive(Default)]
pub struct Civs {
pub civs: Store<Civ>,

View File

@ -139,7 +139,6 @@ pub struct Noise {
}
impl Noise {
#[allow(clippy::identity_op)]
fn new(seed: u32) -> Self {
Self {
cave_nz: SuperSimplex::new().set_seed(seed + 0),

View File

@ -21,7 +21,6 @@ pub fn apply_scatter_to(canvas: &mut Canvas, rng: &mut impl Rng) {
use WaterMode::*;
use SpriteKind::*;
#[allow(clippy::type_complexity)]
// TODO: Add back all sprites we had before
let scatter: &[(
_,

View File

@ -3,7 +3,7 @@
#![allow(
clippy::option_map_unit_fn,
clippy::blocks_in_if_conditions,
clippy::too_many_arguments
clippy::identity_op
)]
#![allow(clippy::branches_sharing_code)] // TODO: evaluate
#![deny(clippy::clone_on_ref_ptr)]

View File

@ -697,6 +697,7 @@ impl m32 {
/// Prediction in Geomorphology, Geophysical Monograph 135.
/// Copyright 2003 by the American Geophysical Union
/// 10.1029/135GM09
#[allow(clippy::too_many_arguments)]
fn erode(
// Underlying map dimensions.
map_size_lg: MapSizeLg,
@ -2339,7 +2340,6 @@ pub fn mrec_downhill(
/// * 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::type_complexity)] // TODO: Pending review in #587
pub fn get_multi_rec<F: fmt::Debug + Float + Sync + Into<Compute>>(
map_size_lg: MapSizeLg,
h: impl Fn(usize) -> F + Sync,
@ -2531,6 +2531,7 @@ pub fn get_multi_rec<F: fmt::Debug + Float + Sync + Into<Compute>>(
}
/// Perform erosion n times.
#[allow(clippy::too_many_arguments)]
pub fn do_erosion(
map_size_lg: MapSizeLg,
_max_uplift: f32,

View File

@ -558,7 +558,6 @@ impl Settlement {
}
}
#[allow(clippy::identity_op)] // TODO: Pending review in #587
pub fn apply_to<'a>(
&'a self,
index: IndexRef,

View File

@ -42,7 +42,6 @@ impl Castle {
}
impl Structure for Castle {
#[allow(clippy::identity_op)]
fn render(&self, site: &Site, _land: &Land, painter: &Painter) {
let wall_height = 24;
let parapet_height = 2;

View File

@ -13,7 +13,6 @@ pub struct StructureGen2d {
pub type StructureField = (Vec2<i32>, u32);
impl StructureGen2d {
#[allow(clippy::identity_op)] // TODO: Pending review in #587
pub fn new(seed: u32, freq: u32, spread: u32) -> Self {
Self {
freq,