mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Remove redundant closures
This commit is contained in:
parent
3a998ca5b9
commit
7760210824
@ -171,7 +171,7 @@ impl Attack {
|
||||
1.0 - (1.0 - damage_reduction) * (1.0 - block_reduction)
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments, clippy::redundant_closure)]
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn apply_attack(
|
||||
&self,
|
||||
attacker: Option<AttackerInfo>,
|
||||
@ -220,8 +220,8 @@ impl Attack {
|
||||
attack_source,
|
||||
dir,
|
||||
damage.damage.kind,
|
||||
|e| emit(e),
|
||||
|o| emit_outcome(o),
|
||||
&mut emit,
|
||||
&mut emit_outcome,
|
||||
);
|
||||
let change = damage.damage.calculate_health_change(
|
||||
damage_reduction,
|
||||
|
@ -381,10 +381,8 @@ pub fn generate_mesh<'a, V: RectRasterableVol<Vox = Block> + ReadVol + Debug + '
|
||||
let get_color =
|
||||
|_: &mut (), pos: Vec3<i32>| flat_get(pos).get_color().unwrap_or_else(Rgb::zero);
|
||||
let get_opacity = |_: &mut (), pos: Vec3<i32>| !flat_get(pos).is_opaque();
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let flat_get = |pos| flat_get(pos);
|
||||
let should_draw = |_: &mut (), pos: Vec3<i32>, delta: Vec3<i32>, _uv| {
|
||||
should_draw_greedy(pos, delta, flat_get)
|
||||
should_draw_greedy(pos, delta, &flat_get)
|
||||
};
|
||||
// NOTE: Conversion to f32 is fine since this i32 is actually in bounds for u16.
|
||||
let mesh_delta = Vec3::new(0.0, 0.0, (z_start + range.min.z) as f32);
|
||||
|
@ -1750,10 +1750,7 @@ pub(crate) fn fill_sinks<F: Float + Send + Sync>(
|
||||
let range = 0..map_size_lg.chunks_len();
|
||||
let oldh = range
|
||||
.into_par_iter()
|
||||
.map(
|
||||
#[allow(clippy::redundant_closure)]
|
||||
|posi| h(posi),
|
||||
)
|
||||
.map(&h)
|
||||
.collect::<Vec<_>>()
|
||||
.into_boxed_slice();
|
||||
let mut newh = oldh
|
||||
@ -2577,10 +2574,7 @@ pub fn do_erosion(
|
||||
// Stream power law slope exponent--link between channel slope and erosion rate.
|
||||
let n = (0..map_size_lg.chunks_len())
|
||||
.into_par_iter()
|
||||
.map(
|
||||
#[allow(clippy::redundant_closure)]
|
||||
|posi| n(posi),
|
||||
)
|
||||
.map(&n)
|
||||
.collect::<Vec<_>>()
|
||||
.into_boxed_slice();
|
||||
// Stream power law concavity index (θ = m/n), turned into an exponent on
|
||||
@ -2593,44 +2587,29 @@ pub fn do_erosion(
|
||||
// Stream power law erodability constant for fluvial erosion (bedrock)
|
||||
let kf = (0..map_size_lg.chunks_len())
|
||||
.into_par_iter()
|
||||
.map(
|
||||
#[allow(clippy::redundant_closure)]
|
||||
|posi| kf(posi),
|
||||
)
|
||||
.map(&kf)
|
||||
.collect::<Vec<_>>()
|
||||
.into_boxed_slice();
|
||||
// Stream power law erodability constant for hillslope diffusion (bedrock)
|
||||
let kd = (0..map_size_lg.chunks_len())
|
||||
.into_par_iter()
|
||||
.map(
|
||||
#[allow(clippy::redundant_closure)]
|
||||
|posi| kd(posi),
|
||||
)
|
||||
.map(&kd)
|
||||
.collect::<Vec<_>>()
|
||||
.into_boxed_slice();
|
||||
// Deposition coefficient
|
||||
let g = (0..map_size_lg.chunks_len())
|
||||
.into_par_iter()
|
||||
.map(
|
||||
#[allow(clippy::redundant_closure)]
|
||||
|posi| g(posi),
|
||||
)
|
||||
.map(&g)
|
||||
.collect::<Vec<_>>()
|
||||
.into_boxed_slice();
|
||||
let epsilon_0 = (0..map_size_lg.chunks_len())
|
||||
.into_par_iter()
|
||||
.map(
|
||||
#[allow(clippy::redundant_closure)]
|
||||
|posi| epsilon_0(posi),
|
||||
)
|
||||
.map(&epsilon_0)
|
||||
.collect::<Vec<_>>()
|
||||
.into_boxed_slice();
|
||||
let alpha = (0..map_size_lg.chunks_len())
|
||||
.into_par_iter()
|
||||
.map(
|
||||
#[allow(clippy::redundant_closure)]
|
||||
|posi| alpha(posi),
|
||||
)
|
||||
.map(&alpha)
|
||||
.collect::<Vec<_>>()
|
||||
.into_boxed_slice();
|
||||
let mut wh = vec![0.0; map_size_lg.chunks_len()].into_boxed_slice();
|
||||
@ -2676,12 +2655,6 @@ pub fn do_erosion(
|
||||
let g = |posi: usize| g[posi];
|
||||
let epsilon_0 = |posi: usize| epsilon_0[posi];
|
||||
let alpha = |posi: usize| alpha[posi];
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let height_scale = |n| height_scale(n);
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let k_da_scale = |q| k_da_scale(q);
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let is_ocean = |posi| is_ocean(posi);
|
||||
|
||||
(0..n_steps).for_each(|i| {
|
||||
debug!("Erosion iteration #{:?}", i);
|
||||
@ -2703,9 +2676,9 @@ pub fn do_erosion(
|
||||
g,
|
||||
epsilon_0,
|
||||
alpha,
|
||||
is_ocean,
|
||||
height_scale,
|
||||
k_da_scale,
|
||||
&is_ocean,
|
||||
&height_scale,
|
||||
&k_da_scale,
|
||||
threadpool,
|
||||
);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user