From 3541cebbf1f934165945ca21651ed33342a3ffea Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Wed, 21 May 2025 12:31:40 +0200 Subject: [PATCH] misc: tpm: streamline error Display::fmt() The changes were mostly automatically applied using the Python script mentioned in the first commit of this series. Signed-off-by: Philipp Schuster On-behalf-of: SAP philipp.schuster@sap.com --- tpm/src/emulator.rs | 14 +++++++------- tpm/src/lib.rs | 2 +- tpm/src/socket.rs | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tpm/src/emulator.rs b/tpm/src/emulator.rs index 3b892d27c..ac762d12a 100644 --- a/tpm/src/emulator.rs +++ b/tpm/src/emulator.rs @@ -45,19 +45,19 @@ pub fn is_selftest(input: &[u8]) -> bool { #[derive(Error, Debug)] pub enum Error { - #[error("Could not initialize emulator's backend: {0}")] + #[error("Could not initialize emulator's backend")] InitializeEmulator(#[source] anyhow::Error), - #[error("Failed to create data fd to pass to swtpm: {0}")] + #[error("Failed to create data fd to pass to swtpm")] PrepareDataFd(#[source] anyhow::Error), - #[error("Failed to run Control Cmd: {0}")] + #[error("Failed to run Control Cmd")] RunControlCmd(#[source] anyhow::Error), - #[error("Emulator doesn't implement min required capabilities: {0}")] + #[error("Emulator doesn't implement min required capabilities")] CheckCaps(#[source] anyhow::Error), - #[error("Emulator failed to deliver request: {0}")] + #[error("Emulator failed to deliver request")] DeliverRequest(#[source] anyhow::Error), - #[error("Emulator failed to send/receive msg on data fd: {0}")] + #[error("Emulator failed to send/receive msg on data fd")] SendReceive(#[source] anyhow::Error), - #[error("Incorrect response to Self Test: {0}")] + #[error("Incorrect response to Self Test")] SelfTest(#[source] anyhow::Error), } diff --git a/tpm/src/lib.rs b/tpm/src/lib.rs index 8625aab71..915386979 100644 --- a/tpm/src/lib.rs +++ b/tpm/src/lib.rs @@ -46,7 +46,7 @@ pub enum Commands { #[derive(Error, Debug)] pub enum Error { - #[error("Failed converting buf to PTM : {0}")] + #[error("Failed converting buf to PTM ")] ConvertToPtm(#[source] anyhow::Error), } type Result = anyhow::Result; diff --git a/tpm/src/socket.rs b/tpm/src/socket.rs index 35b058976..a6ec0d0a4 100644 --- a/tpm/src/socket.rs +++ b/tpm/src/socket.rs @@ -13,11 +13,11 @@ use vmm_sys_util::sock_ctrl_msg::ScmSocket; #[derive(Error, Debug)] pub enum Error { - #[error("Cannot connect to tpm Socket: {0}")] + #[error("Cannot connect to tpm Socket")] ConnectToSocket(#[source] anyhow::Error), - #[error("Failed to read from socket: {0}")] + #[error("Failed to read from socket")] ReadFromSocket(#[source] anyhow::Error), - #[error("Failed to write to socket: {0}")] + #[error("Failed to write to socket")] WriteToSocket(#[source] anyhow::Error), } type Result = anyhow::Result;