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 <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2025-01-21 09:21:58 +01:00
parent daff73bdd6
commit 0477adaf88

View File

@ -53,7 +53,7 @@ impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self { match self {
Self::Unauthorized => f.write_str("unauthorized"), 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::UnexpectedData => write!(f, "api unexpectedly returned data"),
Self::BadApi(msg, _) => write!(f, "api returned unexpected data - {msg}"), Self::BadApi(msg, _) => write!(f, "api returned unexpected data - {msg}"),
Self::Other(err) => f.write_str(err), Self::Other(err) => f.write_str(err),