From 80f836d19d8b45b58f2cf6732b24310ca317cb06 Mon Sep 17 00:00:00 2001 From: David Brown Date: Wed, 10 Mar 2021 05:24:33 -0700 Subject: [PATCH] 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 --- sim/src/image.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sim/src/image.rs b/sim/src/image.rs index cfe20b5d..c4206458 100644 --- a/sim/src/image.rs +++ b/sim/src/image.rs @@ -1564,11 +1564,14 @@ fn install_ptable(flash: &mut SimMultiFlash, areadesc: &AreaDesc) { // aren't marked as the BootLoader partition, avoid adding the // partition table. This makes it harder to view the image, but // avoids messing up images already written. - if areadesc.iter_areas().any(|area| { - area.device_id == id && - area.off == 0 && - area.flash_id != FlashId::BootLoader - }) { + let skip_ptable = areadesc + .iter_areas() + .any(|area| { + area.device_id == id && + area.off == 0 && + area.flash_id != FlashId::BootLoader + }); + if skip_ptable { if log_enabled!(Info) { let special: Vec = areadesc.iter_areas() .filter(|area| area.device_id == id && area.off == 0)