From b88c23e74f6d71747942728f534ac57d3aea20bc Mon Sep 17 00:00:00 2001 From: Jonathan Berglin <jonis9898@hotmail.com> Date: Thu, 15 Jul 2021 21:07:55 +0000 Subject: [PATCH] Resolve all '#[allow(clippy::if_same_then_else)]' error supressions --- common/src/terrain/map.rs | 1 - world/src/column/mod.rs | 7 +------ world/src/layer/tree.rs | 1 - world/src/sim/mod.rs | 1 - world/src/site/settlement/building/archetype/house.rs | 7 +++---- world/src/site/settlement/building/archetype/keep.rs | 1 - 6 files changed, 4 insertions(+), 14 deletions(-) diff --git a/common/src/terrain/map.rs b/common/src/terrain/map.rs index a323f20e31..4b6b39110f 100644 --- a/common/src/terrain/map.rs +++ b/common/src/terrain/map.rs @@ -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::if_same_then_else)] // TODO: Pending review in #587 #[allow(clippy::unnested_or_patterns)] // TODO: Pending review in #587 #[allow(clippy::many_single_char_names)] pub fn generate( diff --git a/world/src/column/mod.rs b/world/src/column/mod.rs index 4e13675ff7..1231469174 100644 --- a/world/src/column/mod.rs +++ b/world/src/column/mod.rs @@ -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::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, index): Self::Index) -> Option<ColumnSample<'a>> { @@ -337,11 +336,7 @@ impl<'a> Sampler<'a> for ColumnGen<'a> { } else { let neighbor_pos = river_chunk_idx.map(|e| e as f64) * neighbor_coef; - if dist.y == 0.0 { - -(wposf - neighbor_pos).magnitude() - } else { - -(wposf - neighbor_pos).magnitude() - } + -(wposf - neighbor_pos).magnitude() }; (Reverse((dist.x, dist.y)), downhill_height) }); diff --git a/world/src/layer/tree.rs b/world/src/layer/tree.rs index 0f8d59e603..bfe188eda2 100644 --- a/world/src/layer/tree.rs +++ b/world/src/layer/tree.rs @@ -41,7 +41,6 @@ static MODEL_RAND: RandomPerm = RandomPerm::new(0xDB21C052); static UNIT_CHOOSER: UnitChooser = UnitChooser::new(0x700F4EC7); static QUIRKY_RAND: RandomPerm = RandomPerm::new(0xA634460F); -#[allow(clippy::if_same_then_else)] pub fn apply_trees_to(canvas: &mut Canvas, dynamic_rng: &mut impl Rng) { // TODO: Get rid of this enum TreeModel { diff --git a/world/src/sim/mod.rs b/world/src/sim/mod.rs index f2657e8679..56cbc5c8eb 100644 --- a/world/src/sim/mod.rs +++ b/world/src/sim/mod.rs @@ -2149,7 +2149,6 @@ pub struct RegionInfo { } impl SimChunk { - #[allow(clippy::if_same_then_else)] // TODO: Pending review in #587 #[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); diff --git a/world/src/site/settlement/building/archetype/house.rs b/world/src/site/settlement/building/archetype/house.rs index c1324446c2..fb9b1f15c6 100644 --- a/world/src/site/settlement/building/archetype/house.rs +++ b/world/src/site/settlement/building/archetype/house.rs @@ -244,7 +244,6 @@ impl Archetype for House { (this, skel) } - #[allow(clippy::if_same_then_else)] // TODO: Pending review in #587 fn draw( &self, index: IndexRef, @@ -455,9 +454,9 @@ impl Archetype for House { if bound_offset.x == bound_offset.y || profile.y == ceil_height { // Support beams return log; - } else if !attr.storey_fill.has_lower() && profile.y < ceil_height { - return EMPTY; - } else if !attr.storey_fill.has_upper() { + } else if !attr.storey_fill.has_lower() && profile.y < ceil_height + || !attr.storey_fill.has_upper() + { return EMPTY; } else { let (frame_bounds, frame_borders) = if profile.y >= ceil_height { diff --git a/world/src/site/settlement/building/archetype/keep.rs b/world/src/site/settlement/building/archetype/keep.rs index 432b7ee36f..749900f9b7 100644 --- a/world/src/site/settlement/building/archetype/keep.rs +++ b/world/src/site/settlement/building/archetype/keep.rs @@ -108,7 +108,6 @@ impl Archetype for Keep { ) } - #[allow(clippy::if_same_then_else)] // TODO: Pending review in #587 fn draw( &self, index: IndexRef,