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,
/// returns the approximate altitude at that column. When in doubt, try
/// using `MapConfig::sample_wpos` for this.
#[allow(clippy::unnested_or_patterns)] // TODO: Pending review in #587
#[allow(clippy::many_single_char_names)]
pub fn generate(
&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
/// 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<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> {
#[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> {
if !pos
.map2(S::SIZE, |e, s| 0 <= e && e < s as i32)

View File

@ -272,7 +272,6 @@ impl<'a> PhysicsData<'a> {
spatial_grid
}
#[allow(clippy::nonminimal_bool)]
fn apply_pushback(&mut self, job: &mut Job<Sys>, spatial_grid: &SpatialGrid) {
span!(_guard, "Apply pushback");
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
// ground (or on the wall)
if !forced_movement &&
!(is_sticky && !is_mid_air)
if !forced_movement
&& !is_sticky
|| is_mid_air
&& diff.magnitude_squared() > 0.0
&& !is_projectile
&& !matches!(
collider_other,
Some(Collider::Voxel { .. })
)
&& !matches!(collider_other,Some(Collider::Voxel { .. }))
&& !matches!(collider, Some(Collider::Voxel { .. }))
{
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);
}
#[allow(clippy::nonminimal_bool)] // TODO: Pending review in #587
/// 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
/// 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()),
) {
// Check that entities still exist
if !(possessor.gen().is_alive() && ecs.is_alive(possessor))
|| !(possesse.gen().is_alive() && ecs.is_alive(possesse))
if !possessor.gen().is_alive()
|| !ecs.is_alive(possessor)
|| !possesse.gen().is_alive()
|| !ecs.is_alive(possesse)
{
error!(
"Error possessing! either the possessor entity or possesse entity no longer exists"

View File

@ -163,7 +163,6 @@ 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: Settings,

View File

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

View File

@ -71,7 +71,6 @@ impl State {
// TODO: remove
// Adds ability3 slot if it is missing and should 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) {
use specs::WorldExt;
let inventories = client.state().ecs().read_storage::<Inventory>();

View File

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

View File

@ -11,11 +11,10 @@ pub struct Vertex {
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<f32>, norm: Vec3<f32>) -> Self {
let (norm_axis, norm_dir) = norm
.as_slice()
.into_iter()
.iter()
.enumerate()
.find(|(_i, e)| **e != 0.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???
type Output = (Primitive, iced::mouse::Interaction);
#[allow(clippy::let_and_return)]
fn layout<'a, M>(
&mut self,
element: &iced::Element<'a, M, Self>,
limits: &iced::layout::Limits,
) -> iced::layout::Node {
span!(_guard, "layout", "IcedRenderer::layout");
let node = element.layout(self, limits);
// Trim text measurements cache?
node
element.layout(self, limits)
}
fn overlay(

View File

@ -24,7 +24,6 @@ const W: usize = 1024;
const H: usize = 1024;
#[allow(clippy::needless_update)] // TODO: Pending review in #587
#[allow(clippy::unused_io_amount)] // TODO: Pending review in #587
fn main() {
FmtSubscriber::builder()
.with_max_level(Level::ERROR)
@ -234,7 +233,9 @@ fn main() {
|pos, (r, g, b, a)| {
let i = pos.x;
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.

View File

@ -15,7 +15,7 @@ use noise::NoiseFn;
use serde::Deserialize;
use std::{
cmp::Reverse,
f32, f64,
f32,
ops::{Add, Div, Mul, Sub},
};
use tracing::error;
@ -60,7 +60,6 @@ impl<'a> Sampler<'a> for ColumnGen<'a> {
type Sample = Option<ColumnSample<'a>>;
#[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
fn get(&self, (wpos, index): Self::Index) -> Option<ColumnSample<'a>> {
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)| {
match river.river_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
// closest point between t = 0.0 and t = 1.0).
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.
///
/// TODO: See if allocating in advance is worthwhile.
#[allow(clippy::let_and_return)] // TODO: Pending review in #587
fn get_max_slope(
map_size_lg: MapSizeLg,
h: &[Alt],

View File

@ -370,8 +370,6 @@ pub struct WorldSim {
}
impl WorldSim {
#[allow(clippy::unnested_or_patterns)] // TODO: Pending review in #587
pub fn generate(seed: u32, opts: WorldOpts, threadpool: &rayon::ThreadPool) -> Self {
// Parse out the contents of various map formats into the values we need.
let parsed_world_file = (|| {
@ -2149,7 +2147,6 @@ pub struct RegionInfo {
}
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 {
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);

View File

@ -57,7 +57,6 @@ pub struct GenCtx<'a, R: Rng> {
pub struct Colors;
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 {
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>) {
let heuristic = move |l: &Vec2<i32>| (l - b).map(|e| e.abs()).reduce_max() as f32;
let neighbors = |l: &Vec2<i32>| {