Resolve all approved error supressions

This commit is contained in:
Jonathan Berglin 2021-07-18 17:11:46 +00:00 committed by Marcel
parent 37147e2a83
commit b15f426ee5
17 changed files with 15 additions and 33 deletions

View File

@ -442,7 +442,6 @@ impl<'a> MapConfig<'a> {
/// sample_wpos is a simple function that, given a *column* position, /// sample_wpos is a simple function that, given a *column* position,
/// returns the approximate altitude at that column. When in doubt, try /// returns the approximate altitude at that column. When in doubt, try
/// using `MapConfig::sample_wpos` for this. /// using `MapConfig::sample_wpos` for this.
#[allow(clippy::unnested_or_patterns)] // TODO: Pending review in #587
#[allow(clippy::many_single_char_names)] #[allow(clippy::many_single_char_names)]
pub fn generate( pub fn generate(
&self, &self,

View File

@ -286,7 +286,6 @@ pub fn river_spline_coeffs(
/// curve"... hopefully this works out okay and gives us what we want (a /// curve"... hopefully this works out okay and gives us what we want (a
/// river that extends outwards tangent to a quadratic curve, with width /// river that extends outwards tangent to a quadratic curve, with width
/// configured by distance along the line). /// configured by distance along the line).
#[allow(clippy::let_and_return)] // TODO: Pending review in #587
#[allow(clippy::many_single_char_names)] #[allow(clippy::many_single_char_names)]
pub fn quadratic_nearest_point( pub fn quadratic_nearest_point(
spline: &Vec3<Vec2<f64>>, spline: &Vec3<Vec2<f64>>,

View File

@ -311,7 +311,6 @@ impl<V, S: VolSize, M> ReadVol for Chunk<V, S, M> {
impl<V: Clone + PartialEq, S: VolSize, M> WriteVol for Chunk<V, S, M> { impl<V: Clone + PartialEq, S: VolSize, M> WriteVol for Chunk<V, S, M> {
#[inline(always)] #[inline(always)]
#[allow(clippy::unit_arg)] // TODO: Pending review in #587
fn set(&mut self, pos: Vec3<i32>, vox: Self::Vox) -> Result<Self::Vox, Self::Error> { fn set(&mut self, pos: Vec3<i32>, vox: Self::Vox) -> Result<Self::Vox, Self::Error> {
if !pos if !pos
.map2(S::SIZE, |e, s| 0 <= e && e < s as i32) .map2(S::SIZE, |e, s| 0 <= e && e < s as i32)

View File

@ -272,7 +272,6 @@ impl<'a> PhysicsData<'a> {
spatial_grid spatial_grid
} }
#[allow(clippy::nonminimal_bool)]
fn apply_pushback(&mut self, job: &mut Job<Sys>, spatial_grid: &SpatialGrid) { fn apply_pushback(&mut self, job: &mut Job<Sys>, spatial_grid: &SpatialGrid) {
span!(_guard, "Apply pushback"); span!(_guard, "Apply pushback");
job.cpu_stats.measure(ParMode::Rayon); job.cpu_stats.measure(ParMode::Rayon);
@ -439,14 +438,12 @@ impl<'a> PhysicsData<'a> {
// //
// Don't apply force when entity is a sticky which is on the // Don't apply force when entity is a sticky which is on the
// ground (or on the wall) // ground (or on the wall)
if !forced_movement && if !forced_movement
!(is_sticky && !is_mid_air) && !is_sticky
|| is_mid_air
&& diff.magnitude_squared() > 0.0 && diff.magnitude_squared() > 0.0
&& !is_projectile && !is_projectile
&& !matches!( && !matches!(collider_other,Some(Collider::Voxel { .. }))
collider_other,
Some(Collider::Voxel { .. })
)
&& !matches!(collider, Some(Collider::Voxel { .. })) && !matches!(collider, Some(Collider::Voxel { .. }))
{ {
let force = 400.0 let force = 400.0

View File

@ -148,7 +148,6 @@ pub fn handle_unmount(server: &mut Server, mounter: EcsEntity) {
state.delete_component::<comp::Mounting>(mounter); state.delete_component::<comp::Mounting>(mounter);
} }
#[allow(clippy::nonminimal_bool)] // TODO: Pending review in #587
/// FIXME: This code is dangerous and needs to be refactored. We can't just /// FIXME: This code is dangerous and needs to be refactored. We can't just
/// comment it out, but it needs to be fixed for a variety of reasons. Get rid /// comment it out, but it needs to be fixed for a variety of reasons. Get rid
/// of this ASAP! /// of this ASAP!
@ -159,8 +158,10 @@ pub fn handle_possess(server: &mut Server, possessor_uid: Uid, possesse_uid: Uid
ecs.entity_from_uid(possesse_uid.into()), ecs.entity_from_uid(possesse_uid.into()),
) { ) {
// Check that entities still exist // Check that entities still exist
if !(possessor.gen().is_alive() && ecs.is_alive(possessor)) if !possessor.gen().is_alive()
|| !(possesse.gen().is_alive() && ecs.is_alive(possesse)) || !ecs.is_alive(possessor)
|| !possesse.gen().is_alive()
|| !ecs.is_alive(possesse)
{ {
error!( error!(
"Error possessing! either the possessor entity or possesse entity no longer exists" "Error possessing! either the possessor entity or possesse entity no longer exists"

View File

@ -163,7 +163,6 @@ pub struct Server {
impl Server { impl Server {
/// Create a new `Server` /// Create a new `Server`
#[allow(clippy::expect_fun_call)] // TODO: Pending review in #587
#[allow(clippy::needless_update)] // TODO: Pending review in #587 #[allow(clippy::needless_update)] // TODO: Pending review in #587
pub fn new( pub fn new(
settings: Settings, settings: Settings,

View File

@ -184,7 +184,6 @@ impl MovementEventMapper {
/// as opening or closing the glider. These methods translate those /// as opening or closing the glider. These methods translate those
/// entity states with some additional data into more specific /// entity states with some additional data into more specific
/// `SfxEvent`'s which we attach sounds to /// `SfxEvent`'s which we attach sounds to
#[allow(clippy::nonminimal_bool)] // TODO: Pending review in #587
fn map_movement_event( fn map_movement_event(
character_state: &CharacterState, character_state: &CharacterState,
physics_state: &PhysicsState, physics_state: &PhysicsState,

View File

@ -71,7 +71,6 @@ impl State {
// TODO: remove // TODO: remove
// Adds ability3 slot if it is missing and should be present // Adds ability3 slot if it is missing and should be present
// Removes if it is there and shouldn't be present // Removes if it is there and shouldn't be present
#[allow(clippy::unnested_or_patterns)] // TODO: Pending review in #587
pub fn maintain_ability3(&mut self, client: &client::Client) { pub fn maintain_ability3(&mut self, client: &client::Client) {
use specs::WorldExt; use specs::WorldExt;
let inventories = client.state().ecs().read_storage::<Inventory>(); let inventories = client.state().ecs().read_storage::<Inventory>();

View File

@ -1,6 +1,5 @@
pub mod bound; pub mod bound;
mod buffer; mod buffer;
#[allow(clippy::single_component_path_imports)] // TODO: Pending review in #587
pub mod consts; pub mod consts;
mod error; mod error;
pub mod instances; pub mod instances;

View File

@ -11,11 +11,10 @@ pub struct Vertex {
impl Vertex { impl Vertex {
#[allow(clippy::identity_op)] // TODO: Pending review in #587 #[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<f32>, norm: Vec3<f32>) -> Self { pub fn new(pos: Vec3<f32>, norm: Vec3<f32>) -> Self {
let (norm_axis, norm_dir) = norm let (norm_axis, norm_dir) = norm
.as_slice() .as_slice()
.into_iter() .iter()
.enumerate() .enumerate()
.find(|(_i, e)| **e != 0.0) .find(|(_i, e)| **e != 0.0)
.unwrap_or((0, &1.0)); .unwrap_or((0, &1.0));

View File

@ -827,18 +827,16 @@ impl iced::Renderer for IcedRenderer {
// TODO: use graph of primitives to enable diffing??? // TODO: use graph of primitives to enable diffing???
type Output = (Primitive, iced::mouse::Interaction); type Output = (Primitive, iced::mouse::Interaction);
#[allow(clippy::let_and_return)]
fn layout<'a, M>( fn layout<'a, M>(
&mut self, &mut self,
element: &iced::Element<'a, M, Self>, element: &iced::Element<'a, M, Self>,
limits: &iced::layout::Limits, limits: &iced::layout::Limits,
) -> iced::layout::Node { ) -> iced::layout::Node {
span!(_guard, "layout", "IcedRenderer::layout"); span!(_guard, "layout", "IcedRenderer::layout");
let node = element.layout(self, limits);
// Trim text measurements cache? // Trim text measurements cache?
node element.layout(self, limits)
} }
fn overlay( fn overlay(

View File

@ -24,7 +24,6 @@ const W: usize = 1024;
const H: usize = 1024; const H: usize = 1024;
#[allow(clippy::needless_update)] // 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() { fn main() {
FmtSubscriber::builder() FmtSubscriber::builder()
.with_max_level(Level::ERROR) .with_max_level(Level::ERROR)
@ -234,7 +233,9 @@ fn main() {
|pos, (r, g, b, a)| { |pos, (r, g, b, a)| {
let i = pos.x; let i = pos.x;
let j = pos.y; let j = pos.y;
(&mut buf[(j * x + i) * 4..]).write(&[r, g, b, a]).unwrap(); (&mut buf[(j * x + i) * 4..])
.write_all(&[r, g, b, a])
.unwrap();
}, },
); );
// TODO: Justify fits in u32. // TODO: Justify fits in u32.

View File

@ -15,7 +15,7 @@ use noise::NoiseFn;
use serde::Deserialize; use serde::Deserialize;
use std::{ use std::{
cmp::Reverse, cmp::Reverse,
f32, f64, f32,
ops::{Add, Div, Mul, Sub}, ops::{Add, Div, Mul, Sub},
}; };
use tracing::error; use tracing::error;
@ -60,7 +60,6 @@ impl<'a> Sampler<'a> for ColumnGen<'a> {
type Sample = Option<ColumnSample<'a>>; type Sample = Option<ColumnSample<'a>>;
#[allow(clippy::float_cmp)] // TODO: Pending review in #587 #[allow(clippy::float_cmp)] // TODO: Pending review in #587
#[allow(clippy::nonminimal_bool)] // TODO: Pending review in #587
#[allow(clippy::single_match)] // TODO: Pending review in #587 #[allow(clippy::single_match)] // TODO: Pending review in #587
fn get(&self, (wpos, index): Self::Index) -> Option<ColumnSample<'a>> { fn get(&self, (wpos, index): Self::Index) -> Option<ColumnSample<'a>> {
let wposf = wpos.map(|e| e as f64); let wposf = wpos.map(|e| e as f64);
@ -321,7 +320,7 @@ impl<'a> Sampler<'a> for ColumnGen<'a> {
neighbor_river_data.for_each(|(river_chunk_idx, river_chunk, river, dist)| { neighbor_river_data.for_each(|(river_chunk_idx, river_chunk, river, dist)| {
match river.river_kind { match river.river_kind {
Some(kind) => { Some(kind) => {
if kind.is_river() && !dist.is_some() { if kind.is_river() && dist.is_none() {
// Ostensibly near a river segment, but not "usefully" so (there is no // Ostensibly near a river segment, but not "usefully" so (there is no
// closest point between t = 0.0 and t = 1.0). // closest point between t = 0.0 and t = 1.0).
return; return;

View File

@ -549,7 +549,6 @@ pub fn get_rivers<F: fmt::Debug + Float + Into<f64>, G: Float + Into<f64>>(
/// Precompute the maximum slope at all points. /// Precompute the maximum slope at all points.
/// ///
/// TODO: See if allocating in advance is worthwhile. /// TODO: See if allocating in advance is worthwhile.
#[allow(clippy::let_and_return)] // TODO: Pending review in #587
fn get_max_slope( fn get_max_slope(
map_size_lg: MapSizeLg, map_size_lg: MapSizeLg,
h: &[Alt], h: &[Alt],

View File

@ -370,8 +370,6 @@ pub struct WorldSim {
} }
impl WorldSim { impl WorldSim {
#[allow(clippy::unnested_or_patterns)] // TODO: Pending review in #587
pub fn generate(seed: u32, opts: WorldOpts, threadpool: &rayon::ThreadPool) -> Self { pub fn generate(seed: u32, opts: WorldOpts, threadpool: &rayon::ThreadPool) -> Self {
// Parse out the contents of various map formats into the values we need. // Parse out the contents of various map formats into the values we need.
let parsed_world_file = (|| { let parsed_world_file = (|| {
@ -2149,7 +2147,6 @@ pub struct RegionInfo {
} }
impl SimChunk { impl SimChunk {
#[allow(clippy::unnested_or_patterns)] // TODO: Pending review in #587
fn generate(map_size_lg: MapSizeLg, posi: usize, gen_ctx: &GenCtx, gen_cdf: &GenCdf) -> Self { fn generate(map_size_lg: MapSizeLg, posi: usize, gen_ctx: &GenCtx, gen_cdf: &GenCdf) -> Self {
let pos = uniform_idx_as_vec2(map_size_lg, posi); let pos = uniform_idx_as_vec2(map_size_lg, posi);
let wposf = (pos * TerrainChunkSize::RECT_SIZE.map(|e| e as i32)).map(|e| e as f64); let wposf = (pos * TerrainChunkSize::RECT_SIZE.map(|e| e as i32)).map(|e| e as f64);

View File

@ -57,7 +57,6 @@ pub struct GenCtx<'a, R: Rng> {
pub struct Colors; pub struct Colors;
impl Castle { impl Castle {
#[allow(clippy::let_and_return)] // TODO: Pending review in #587
pub fn generate(wpos: Vec2<i32>, sim: Option<&mut WorldSim>, rng: &mut impl Rng) -> Self { pub fn generate(wpos: Vec2<i32>, sim: Option<&mut WorldSim>, rng: &mut impl Rng) -> Self {
let ctx = GenCtx { sim, rng }; let ctx = GenCtx { sim, rng };

View File

@ -545,7 +545,6 @@ impl Floor {
} }
} }
#[allow(clippy::unnested_or_patterns)] // TODO: Pending review in #587
fn create_route(&mut self, _ctx: &mut GenCtx<impl Rng>, a: Vec2<i32>, b: Vec2<i32>) { fn create_route(&mut self, _ctx: &mut GenCtx<impl Rng>, a: Vec2<i32>, b: Vec2<i32>) {
let heuristic = move |l: &Vec2<i32>| (l - b).map(|e| e.abs()).reduce_max() as f32; let heuristic = move |l: &Vec2<i32>| (l - b).map(|e| e.abs()).reduce_max() as f32;
let neighbors = |l: &Vec2<i32>| { let neighbors = |l: &Vec2<i32>| {