From 1997f539f75673d254e3e84e3cc89654849c1c71 Mon Sep 17 00:00:00 2001 From: David Brown Date: Wed, 10 Mar 2021 05:04:05 -0700 Subject: [PATCH] sim: Remove extraneous static According to clippy, `&'static` can just be `&` for static definitions, which always have a static lifetime. Clean this up in the arrays in the code, as well as generation code in imgtool. Signed-off-by: David Brown --- scripts/imgtool/keys/general.py | 2 +- sim/mcuboot-sys/src/c.rs | 1 - sim/src/ecdsa_pub_key-rs.txt | 2 +- sim/src/ed25519_pub_key-rs.txt | 2 +- sim/src/lib.rs | 4 ++-- sim/src/rsa3072_pub_key-rs.txt | 2 +- sim/src/rsa_pub_key-rs.txt | 2 +- 7 files changed, 7 insertions(+), 8 deletions(-) diff --git a/scripts/imgtool/keys/general.py b/scripts/imgtool/keys/general.py index e8755f6c..8e3c65b2 100644 --- a/scripts/imgtool/keys/general.py +++ b/scripts/imgtool/keys/general.py @@ -31,7 +31,7 @@ class KeyClass(object): def emit_rust_public(self, file=sys.stdout): self._emit( - header="static {}_PUB_KEY: &'static [u8] = &[".format(self.shortname().upper()), + header="static {}_PUB_KEY: &[u8] = &[".format(self.shortname().upper()), trailer="];", encoded_bytes=self.get_public_bytes(), indent=" ", diff --git a/sim/mcuboot-sys/src/c.rs b/sim/mcuboot-sys/src/c.rs index 61276e27..b1689738 100644 --- a/sim/mcuboot-sys/src/c.rs +++ b/sim/mcuboot-sys/src/c.rs @@ -8,7 +8,6 @@ use crate::area::AreaDesc; use simflash::SimMultiFlash; -use libc; use crate::api; /// Invoke the bootloader on this flash device. diff --git a/sim/src/ecdsa_pub_key-rs.txt b/sim/src/ecdsa_pub_key-rs.txt index b63f6b00..e3a0cc1a 100644 --- a/sim/src/ecdsa_pub_key-rs.txt +++ b/sim/src/ecdsa_pub_key-rs.txt @@ -1,4 +1,4 @@ -static ECDSA256_PUB_KEY: &'static [u8] = &[ +static ECDSA256_PUB_KEY: &[u8] = &[ 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, diff --git a/sim/src/ed25519_pub_key-rs.txt b/sim/src/ed25519_pub_key-rs.txt index f624fe3b..8abce32d 100644 --- a/sim/src/ed25519_pub_key-rs.txt +++ b/sim/src/ed25519_pub_key-rs.txt @@ -1,4 +1,4 @@ -static ED25519_PUB_KEY: &'static [u8] = &[ +static ED25519_PUB_KEY: &[u8] = &[ 0x30, 0x2a, 0x30, 0x05, 0x06, 0x03, 0x2b, 0x65, 0x70, 0x03, 0x21, 0x00, 0xd4, 0xb3, 0x1b, 0xa4, 0x9a, 0x3a, 0xdd, 0x3f, 0x82, 0x5d, 0x10, 0xca, diff --git a/sim/src/lib.rs b/sim/src/lib.rs index 93cdbfa9..e6023278 100644 --- a/sim/src/lib.rs +++ b/sim/src/lib.rs @@ -33,7 +33,7 @@ pub use crate::{ }, }; -const USAGE: &'static str = " +const USAGE: &str = " Mcuboot simulator Usage: @@ -67,7 +67,7 @@ pub enum DeviceName { Nrf52840UnequalSlots, } -pub static ALL_DEVICES: &'static [DeviceName] = &[ +pub static ALL_DEVICES: &[DeviceName] = &[ DeviceName::Stm32f4, DeviceName::K64f, DeviceName::K64fBig, diff --git a/sim/src/rsa3072_pub_key-rs.txt b/sim/src/rsa3072_pub_key-rs.txt index 983009cf..16ca30df 100644 --- a/sim/src/rsa3072_pub_key-rs.txt +++ b/sim/src/rsa3072_pub_key-rs.txt @@ -1,5 +1,5 @@ /* Autogenerated by imgtool.py, do not edit. */ -static RSA3072_PUB_KEY: &'static [u8] = &[ +static RSA3072_PUB_KEY: &[u8] = &[ 0x30, 0x82, 0x01, 0x8a, 0x02, 0x82, 0x01, 0x81, 0x00, 0xb4, 0x2c, 0x0e, 0x98, 0x58, 0x10, 0xa4, 0xa7, 0x58, 0x99, 0x7c, 0x01, 0xdd, 0x08, 0x2a, diff --git a/sim/src/rsa_pub_key-rs.txt b/sim/src/rsa_pub_key-rs.txt index 288759db..f6466f83 100644 --- a/sim/src/rsa_pub_key-rs.txt +++ b/sim/src/rsa_pub_key-rs.txt @@ -1,5 +1,5 @@ /* Autogenerated by imgtool.py, do not edit. */ -static RSA_PUB_KEY: &'static [u8] = &[ +static RSA_PUB_KEY: &[u8] = &[ 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xd1, 0x06, 0x08, 0x1a, 0x18, 0x44, 0x2c, 0x18, 0xe8, 0xfb, 0xfd, 0xf7, 0x0d, 0xa3, 0x4f,