diff options
author | Griffin Smith <root@gws.fyi> | 2019-07-29T15·46-0400 |
---|---|---|
committer | Griffin Smith <root@gws.fyi> | 2019-08-03T16·41-0400 |
commit | 7138d9a0b627b64f31558f0f4820dec7e55fdee4 (patch) | |
tree | a6ea851cdd647cf4cd881dfa62f761b6fdf43cb8 /src/level_gen/util.rs | |
parent | 9db5fad2f900732d59f9714ac4517952d26506d7 (diff) |
Add clippy to circleCI and fix all lints
Diffstat (limited to 'src/level_gen/util.rs')
-rw-r--r-- | src/level_gen/util.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/level_gen/util.rs b/src/level_gen/util.rs index c9cd87309257..4f56fe6c9557 100644 --- a/src/level_gen/util.rs +++ b/src/level_gen/util.rs @@ -1,7 +1,7 @@ use crate::types::Dimensions; use rand::{distributions, Rng}; -pub fn falses(dims: &Dimensions) -> Vec<Vec<bool>> { +pub fn falses(dims: Dimensions) -> Vec<Vec<bool>> { let mut ret = Vec::with_capacity(dims.h as usize); for _ in 0..dims.h { let mut row = Vec::with_capacity(dims.w as usize); @@ -16,7 +16,7 @@ pub fn falses(dims: &Dimensions) -> Vec<Vec<bool>> { /// Randomly initialize a 2-dimensional boolean vector of the given /// `Dimensions`, using the given random number generator and alive chance pub fn rand_initialize<R: Rng + ?Sized>( - dims: &Dimensions, + dims: Dimensions, rng: &mut R, alive_chance: f64, ) -> Vec<Vec<bool>> { @@ -40,9 +40,9 @@ pub fn fill_outer_edges(level: &mut Vec<Vec<bool>>) { } let ymax = level[0].len(); - for x in 0..xmax { - level[x][0] = true; - level[x][ymax - 1] = true; + for row in level.iter_mut() { + row[0] = true; + row[ymax - 1] = true; } for y in 0..level[0].len() { |