[pbs-devel] [PATCH proxmox 04/15] clippy fix: needless borrow
Lukas Wagner
l.wagner at proxmox.com
Tue Aug 8 10:01:42 CEST 2023
See:
https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
Signed-off-by: Lukas Wagner <l.wagner at proxmox.com>
---
proxmox-openid/src/lib.rs | 2 +-
proxmox-rest-server/src/rest.rs | 4 ++--
proxmox-schema/src/de/cow3.rs | 2 +-
proxmox-schema/src/de/mod.rs | 2 +-
proxmox-tfa/src/totp.rs | 8 ++++----
5 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/proxmox-openid/src/lib.rs b/proxmox-openid/src/lib.rs
index 825975b..d6ed89b 100644
--- a/proxmox-openid/src/lib.rs
+++ b/proxmox-openid/src/lib.rs
@@ -221,7 +221,7 @@ impl OpenIdAuthenticator {
private_auth_state: &PrivateAuthState,
) -> Result<Value, Error> {
let (id_token_claims, userinfo_claims) =
- self.verify_authorization_code(&code, &private_auth_state)?;
+ self.verify_authorization_code(code, private_auth_state)?;
let mut data = serde_json::to_value(id_token_claims)?;
diff --git a/proxmox-rest-server/src/rest.rs b/proxmox-rest-server/src/rest.rs
index cffcedc..b4f35aa 100644
--- a/proxmox-rest-server/src/rest.rs
+++ b/proxmox-rest-server/src/rest.rs
@@ -946,7 +946,7 @@ impl Formatted {
let result = if api_method.protected
&& rpcenv.env_type == RpcEnvironmentType::PUBLIC
{
- proxy_protected_request(api_method, parts, body, &peer).await
+ proxy_protected_request(api_method, parts, body, peer).await
} else {
handle_api_request(rpcenv, api_method, formatter, parts, body, uri_param).await
};
@@ -1051,7 +1051,7 @@ impl Unformatted {
let result = if api_method.protected
&& rpcenv.env_type == RpcEnvironmentType::PUBLIC
{
- proxy_protected_request(api_method, parts, body, &peer).await
+ proxy_protected_request(api_method, parts, body, peer).await
} else {
handle_unformatted_api_request(rpcenv, api_method, parts, body, uri_param).await
};
diff --git a/proxmox-schema/src/de/cow3.rs b/proxmox-schema/src/de/cow3.rs
index 3044681..73bf8b5 100644
--- a/proxmox-schema/src/de/cow3.rs
+++ b/proxmox-schema/src/de/cow3.rs
@@ -93,7 +93,7 @@ where
<B as ToOwned>::Owned: Borrow<B>,
{
fn as_ref(&self) -> &B {
- &self
+ self
}
}
diff --git a/proxmox-schema/src/de/mod.rs b/proxmox-schema/src/de/mod.rs
index 804ffcc..80d92fd 100644
--- a/proxmox-schema/src/de/mod.rs
+++ b/proxmox-schema/src/de/mod.rs
@@ -588,7 +588,7 @@ impl<'de, 'i> de::MapAccess<'de> for MapAccess<'de, 'i> {
let (key, schema) = match key {
Some(key) => {
- let schema = self.schema.lookup(&key);
+ let schema = self.schema.lookup(key);
let key = match str_slice_to_range(&self.input, key) {
None => Cow::Owned(key.to_string()),
Some(range) => match &self.input {
diff --git a/proxmox-tfa/src/totp.rs b/proxmox-tfa/src/totp.rs
index 97be715..1827e43 100644
--- a/proxmox-tfa/src/totp.rs
+++ b/proxmox-tfa/src/totp.rs
@@ -36,12 +36,12 @@ impl StdError for Error {
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
- Error::Generic(e) => f.write_str(&e),
- Error::Decode(m, _e) => f.write_str(&m),
- Error::Ssl(m, _e) => f.write_str(&m),
+ Error::Generic(e) => f.write_str(e),
+ Error::Decode(m, _e) => f.write_str(m),
+ Error::Ssl(m, _e) => f.write_str(m),
Error::UnsupportedAlgorithm(a) => write!(f, "unsupported algorithm: '{a}'"),
Error::UnknownParameter(p) => write!(f, "unknown otpauth uri parameter: '{p}'"),
- Error::BadParameter(m, _e) => f.write_str(&m),
+ Error::BadParameter(m, _e) => f.write_str(m),
}
}
}
--
2.39.2
More information about the pbs-devel
mailing list