From db34c02261c145ff5383d434206567524c18880b Mon Sep 17 00:00:00 2001 From: Eugene Koira Date: Tue, 14 May 2024 14:33:56 +0000 Subject: [PATCH] clippy: resolve build errors for Rust 1.78 Resolving a couple of clippy errors when building with Rust 1.78: * https://rust-lang.github.io/rust-clippy/master/index.html\#/unnecessary_get_then_check * https://rust-lang.github.io/rust-clippy/master/index.html\#/unnecessary_to_owned * https://rust-lang.github.io/rust-clippy/master/index.html\#/to_string_trait_impl Signed-off-by: Eugene Koira --- src/enclave_proc/resource_manager.rs | 11 +++++------ src/lib.rs | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/enclave_proc/resource_manager.rs b/src/enclave_proc/resource_manager.rs index 294c88f2..d67d6eea 100644 --- a/src/enclave_proc/resource_manager.rs +++ b/src/enclave_proc/resource_manager.rs @@ -169,14 +169,13 @@ pub struct EnclaveManager { enclave_handle: Arc>, } -impl ToString for EnclaveState { - fn to_string(&self) -> String { +impl std::fmt::Display for EnclaveState { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { - EnclaveState::Empty => "EMPTY", - EnclaveState::Running => "RUNNING", - EnclaveState::Terminating => "TERMINATING", + EnclaveState::Empty => write!(f, "EMPTY"), + EnclaveState::Running => write!(f, "RUNNING"), + EnclaveState::Terminating => write!(f, "TERMINATING"), } - .to_string() } } diff --git a/src/lib.rs b/src/lib.rs index 169e64b0..818c722f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -263,7 +263,7 @@ pub fn describe_eif(eif_path: String) -> NitroCliResult { }; // Check if signature section is present - if measurements.get(&"PCR8".to_string()).is_some() { + if measurements.contains_key("PCR8") { let cert_info = eif_reader .get_certificate_info(measurements) .map_err(|err| {