diff --git a/crates/rpack_cli/src/lib.rs b/crates/rpack_cli/src/lib.rs index 29ab9bd..cf518d0 100644 --- a/crates/rpack_cli/src/lib.rs +++ b/crates/rpack_cli/src/lib.rs @@ -363,9 +363,8 @@ impl TilemapGenerationConfig { } } }; - let working_dir = std::path::absolute(dir).unwrap_or_default(); - working_dir + std::path::absolute(dir).unwrap_or_default() } pub fn generate(&self) -> anyhow::Result<()> { diff --git a/crates/rpack_cli/src/packer.rs b/crates/rpack_cli/src/packer.rs index f9102de..bb30249 100644 --- a/crates/rpack_cli/src/packer.rs +++ b/crates/rpack_cli/src/packer.rs @@ -70,24 +70,23 @@ impl SkylinePacker { // keep the `bottom` and `width` as small as possible for i in 0..self.skylines.len() { - if let Some(r) = self.can_put(i, w, h) { - if r.bottom() < bottom || (r.bottom() == bottom && self.skylines[i].w < width) { - bottom = r.bottom(); - width = self.skylines[i].w; - index = Some(i); - rect = r; - } + if let Some(r) = self.can_put(i, w, h) + && (r.bottom() < bottom || (r.bottom() == bottom && self.skylines[i].w < width)) + { + bottom = r.bottom(); + width = self.skylines[i].w; + index = Some(i); + rect = r; } - if self.config.allow_rotation { - if let Some(r) = self.can_put(i, h, w) { - if r.bottom() < bottom || (r.bottom() == bottom && self.skylines[i].w < width) { - bottom = r.bottom(); - width = self.skylines[i].w; - index = Some(i); - rect = r; - } - } + if self.config.allow_rotation + && let Some(r) = self.can_put(i, h, w) + && (r.bottom() < bottom || (r.bottom() == bottom && self.skylines[i].w < width)) + { + bottom = r.bottom(); + width = self.skylines[i].w; + index = Some(i); + rect = r; } }