public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Lukas Wagner <l.wagner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox 04/15] clippy fix: needless borrow
Date: Tue,  8 Aug 2023 10:01:42 +0200	[thread overview]
Message-ID: <20230808080153.79587-4-l.wagner@proxmox.com> (raw)
In-Reply-To: <20230808080153.79587-1-l.wagner@proxmox.com>

See:
https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Signed-off-by: Lukas Wagner <l.wagner@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





  parent reply	other threads:[~2023-08-08  8:02 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-08  8:01 [pbs-devel] [PATCH proxmox 01/15] clippy fix: the borrowed expression implements the required traits Lukas Wagner
2023-08-08  8:01 ` [pbs-devel] [PATCH proxmox 02/15] clippy fix: casting to the same type is unnecessary Lukas Wagner
2023-08-08  8:01 ` [pbs-devel] [PATCH proxmox 03/15] clippy fix: calls to `drop` with a value that implements `Copy` Lukas Wagner
2023-08-08  8:01 ` Lukas Wagner [this message]
2023-08-08  8:01 ` [pbs-devel] [PATCH proxmox 05/15] clippy fix: unneeded `return` statement Lukas Wagner
2023-08-08  8:01 ` [pbs-devel] [PATCH proxmox 06/15] clippy fix: redundant closure Lukas Wagner
2023-08-08  8:01 ` [pbs-devel] [PATCH proxmox 07/15] clippy fix: this (Default) `impl` can be derived Lukas Wagner
2023-08-08  8:01 ` [pbs-devel] [PATCH proxmox 08/15] clippy fix: you should consider adding a `Default` implementation Lukas Wagner
2023-08-08  8:01 ` [pbs-devel] [PATCH proxmox 09/15] clippy fix: unnecessary use of `to_string` Lukas Wagner
2023-08-08  8:01 ` [pbs-devel] [PATCH proxmox 10/15] clippy fix: binary comparison to literal `Option::None` Lukas Wagner
2023-08-08  8:01 ` [pbs-devel] [PATCH proxmox 11/15] clippy fix: warning: this let-binding has unit value Lukas Wagner
2023-08-08  8:01 ` [pbs-devel] [PATCH proxmox 12/15] clippy fix: useless use of `format!` Lukas Wagner
2023-08-08  8:01 ` [pbs-devel] [PATCH proxmox 13/15] clippy fix: the following explicit lifetimes could be elided Lukas Wagner
2023-08-08  8:01 ` [pbs-devel] [PATCH proxmox 14/15] clippy fix: complex type definitions Lukas Wagner
2023-08-08  8:01 ` [pbs-devel] [PATCH proxmox 15/15] clippy fix: deref on an immutable reference Lukas Wagner
2023-08-08  9:33 ` [pbs-devel] partially-applied: [PATCH proxmox 01/15] clippy fix: the borrowed expression implements the required traits Wolfgang Bumiller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230808080153.79587-4-l.wagner@proxmox.com \
    --to=l.wagner@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal