[pbs-devel] [PATCH proxmox 06/15] clippy fix: redundant closure
Lukas Wagner
l.wagner at proxmox.com
Tue Aug 8 10:01:44 CEST 2023
See:
https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
Signed-off-by: Lukas Wagner <l.wagner at proxmox.com>
---
proxmox-openid/src/lib.rs | 2 +-
proxmox-schema/src/de/mod.rs | 10 +++-------
2 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/proxmox-openid/src/lib.rs b/proxmox-openid/src/lib.rs
index d6ed89b..c2b73c9 100644
--- a/proxmox-openid/src/lib.rs
+++ b/proxmox-openid/src/lib.rs
@@ -107,7 +107,7 @@ impl PrivateAuthState {
impl OpenIdAuthenticator {
pub fn discover(config: &OpenIdConfig, redirect_url: &str) -> Result<Self, Error> {
let client_id = ClientId::new(config.client_id.clone());
- let client_key = config.client_key.clone().map(|key| ClientSecret::new(key));
+ let client_key = config.client_key.clone().map(ClientSecret::new);
let issuer_url = IssuerUrl::new(config.issuer_url.clone())?;
let provider_metadata = CoreProviderMetadata::discover(&issuer_url, http_client)?;
diff --git a/proxmox-schema/src/de/mod.rs b/proxmox-schema/src/de/mod.rs
index 80d92fd..8cb3761 100644
--- a/proxmox-schema/src/de/mod.rs
+++ b/proxmox-schema/src/de/mod.rs
@@ -109,7 +109,7 @@ impl<'de, 'i> SchemaDeserializer<'de, 'i> {
if !IN_PROPERTY_STRING.with(|v| v.get()) {
schema
.check_constraints(&self.input)
- .map_err(|err| Error::invalid(err))?;
+ .map_err(Error::invalid)?;
}
match self.input {
Cow3::Original(input) => visitor.visit_borrowed_str(input),
@@ -175,9 +175,7 @@ impl<'de, 'i> de::Deserializer<'de> for SchemaDeserializer<'de, 'i> {
.parse()
.map_err(|_| Error::msg(format!("not an integer: {:?}", self.input)))?;
- schema
- .check_constraints(value)
- .map_err(|err| Error::invalid(err))?;
+ schema.check_constraints(value).map_err(Error::invalid)?;
let value: i64 = i64::try_from(value)
.map_err(|_| Error::invalid("isize did not fit into i64"))?;
@@ -194,9 +192,7 @@ impl<'de, 'i> de::Deserializer<'de> for SchemaDeserializer<'de, 'i> {
.parse()
.map_err(|_| Error::msg(format!("not a valid number: {:?}", self.input)))?;
- schema
- .check_constraints(value)
- .map_err(|err| Error::invalid(err))?;
+ schema.check_constraints(value).map_err(Error::invalid)?;
visitor.visit_f64(value)
}
--
2.39.2
More information about the pbs-devel
mailing list