From 0477adaf883e86fe6e7a076436af88e652c47b27 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Tue, 21 Jan 2025 09:21:58 +0100 Subject: [PATCH] client: fix code-style issue when formatting error Fixes a style issue introduced by b31ab119 ("client: improve api error message (avoid duplicate status code)"), as one always should use inline variables for format template strings even if there are some that cannot be used, e.g. as some method needs to be called on them like here. The reason for this is to reduce the amount of free-standing "{}" and parameters as that reduces the need to manually match what "{}" resolves to which expression. While it is not that bad for only two format variables it's still not winning us anything if we don't do it and breaks consistency with newer code style. Noticed as that commit made the line overly long, causing rustfmt changing the line. Signed-off-by: Thomas Lamprecht --- proxmox-client/src/error.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proxmox-client/src/error.rs b/proxmox-client/src/error.rs index e1c3fcc4..1dfee10c 100644 --- a/proxmox-client/src/error.rs +++ b/proxmox-client/src/error.rs @@ -53,7 +53,7 @@ impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { Self::Unauthorized => f.write_str("unauthorized"), - Self::Api(status, msg) => write!(f, "api error (status = {}: {})", status.as_u16(), msg), + Self::Api(status, msg) => write!(f, "api error (status = {}: {msg})", status.as_u16()), Self::UnexpectedData => write!(f, "api unexpectedly returned data"), Self::BadApi(msg, _) => write!(f, "api returned unexpected data - {msg}"), Self::Other(err) => f.write_str(err),