Skip to content

Commit 80f836d

Browse files
committed
sim: Remove complexity from an if
Clippy suggests that having a closure in the condition of an if can be confusing in regards to code formatting. Move the conditional outside of the if into a temp variable. Signed-off-by: David Brown <david.brown@linaro.org>
1 parent d36f6b1 commit 80f836d

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

sim/src/image.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1564,11 +1564,14 @@ fn install_ptable(flash: &mut SimMultiFlash, areadesc: &AreaDesc) {
15641564
// aren't marked as the BootLoader partition, avoid adding the
15651565
// partition table. This makes it harder to view the image, but
15661566
// avoids messing up images already written.
1567-
if areadesc.iter_areas().any(|area| {
1568-
area.device_id == id &&
1569-
area.off == 0 &&
1570-
area.flash_id != FlashId::BootLoader
1571-
}) {
1567+
let skip_ptable = areadesc
1568+
.iter_areas()
1569+
.any(|area| {
1570+
area.device_id == id &&
1571+
area.off == 0 &&
1572+
area.flash_id != FlashId::BootLoader
1573+
});
1574+
if skip_ptable {
15721575
if log_enabled!(Info) {
15731576
let special: Vec<FlashId> = areadesc.iter_areas()
15741577
.filter(|area| area.device_id == id && area.off == 0)

0 commit comments

Comments
 (0)