]> git.proxmox.com Git - proxmox.git/commitdiff
clippy fix: needless borrow
authorLukas Wagner <l.wagner@proxmox.com>
Tue, 8 Aug 2023 08:01:42 +0000 (10:01 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Tue, 8 Aug 2023 09:29:36 +0000 (11:29 +0200)
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
proxmox-rest-server/src/rest.rs
proxmox-schema/src/de/cow3.rs
proxmox-schema/src/de/mod.rs
proxmox-tfa/src/totp.rs

index 825975bbdbb6b4fdc2bea1e63aa42f01578d1c84..d6ed89bf36aebd3aa8f5230283df5c859a72b023 100644 (file)
@@ -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)?;
 
index cffcedcded31bf9f014b6f81e0c17f371bbe20f5..b4f35aa83d1671b79860e3a228371c2a775b7c3c 100644 (file)
@@ -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
                 };
index 30446818a6907d6a0a984a3c18a4d3989ceb47ca..73bf8b5a9eb1e7fee110c4f75d3757e4a9abfb26 100644 (file)
@@ -93,7 +93,7 @@ where
     <B as ToOwned>::Owned: Borrow<B>,
 {
     fn as_ref(&self) -> &B {
-        &self
+        self
     }
 }
 
index 804ffccf1dee464cab778d7e6fbdbd8a8647982e..80d92fdac0b5ecfedcb8b3e9ca0fef7025becf5e 100644 (file)
@@ -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 {
index 97be715a38789b4ad263b9ceacb7fa43a582acde..1827e435e7d8ff0d6110aba63729e8a7b51744e5 100644 (file)
@@ -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),
         }
     }
 }