sim: Remove Option from MAGIC
This constant array is always just unwrapped. Remove the Option from
its type, and just make it an array.
Signed-off-by: David Brown <david.brown@linaro.org>
diff --git a/sim/src/image.rs b/sim/src/image.rs
index d183c40..fe51d9e 100644
--- a/sim/src/image.rs
+++ b/sim/src/image.rs
@@ -1338,7 +1338,7 @@
failed |= match magic {
Some(v) => {
- if v == 1 && ©[24..] != MAGIC.unwrap() {
+ if v == 1 && ©[24..] != MAGIC {
warn!("\"magic\" mismatch at {:#x}", offset);
true
} else if v == 3 {
@@ -1468,10 +1468,10 @@
pub dev_id: u8,
}
-const MAGIC: Option<&[u8]> = Some(&[0x77, 0xc2, 0x95, 0xf3,
- 0x60, 0xd2, 0xef, 0x7f,
- 0x35, 0x52, 0x50, 0x0f,
- 0x2c, 0xb6, 0x79, 0x80]);
+const MAGIC: &[u8] = &[0x77, 0xc2, 0x95, 0xf3,
+ 0x60, 0xd2, 0xef, 0x7f,
+ 0x35, 0x52, 0x50, 0x0f,
+ 0x2c, 0xb6, 0x79, 0x80];
// Replicates defines found in bootutil.h
const BOOT_MAGIC_GOOD: Option<u8> = Some(1);
@@ -1484,7 +1484,7 @@
pub fn mark_upgrade(flash: &mut SimMultiFlash, slot: &SlotInfo) {
let dev = flash.get_mut(&slot.dev_id).unwrap();
let offset = slot.trailer_off + c::boot_max_align() * 4;
- dev.write(offset, MAGIC.unwrap()).unwrap();
+ dev.write(offset, MAGIC).unwrap();
}
/// Writes the image_ok flag which, guess what, tells the bootloader