diff options
author | Heiko Schaefer <heiko@schaefer.name> | 2021-11-03 21:47:33 +0100 |
---|---|---|
committer | Heiko Schaefer <heiko@schaefer.name> | 2021-11-03 21:52:09 +0100 |
commit | 21b6c7d502fd9eb5f1a730e9c89886b3c401a5b6 (patch) | |
tree | 7e92ccdc0c25bbb7ff02df536d79ae2dda74bb8e | |
parent | 690b097bbded71514c57a09b6a0a23c8c0647d99 (diff) | |
download | openpgp-ca-21b6c7d502fd9eb5f1a730e9c89886b3c401a5b6.tar.gz |
Clippy lints.
-rw-r--r-- | openpgp-ca-restd/src/process_certs.rs | 21 | ||||
-rw-r--r-- | openpgp-ca-restd/src/restd.rs | 18 |
2 files changed, 15 insertions, 24 deletions
diff --git a/openpgp-ca-restd/src/process_certs.rs b/openpgp-ca-restd/src/process_certs.rs index 6d28723..a2da010 100644 --- a/openpgp-ca-restd/src/process_certs.rs +++ b/openpgp-ca-restd/src/process_certs.rs @@ -167,13 +167,13 @@ fn validate_and_strip_user_ids( } // split up user_ids between "external" and "internal" emails, then: - match split_emails(&my_domain, user_emails) { + match split_emails(my_domain, user_emails) { Ok((int_provided, _)) => { let mut filter_uid = Vec::new(); for user_id in cert.userids() { if let Ok(Some(email)) = user_id.email() { - let in_domain = is_email_in_domain(&email, &my_domain); + let in_domain = is_email_in_domain(&email, my_domain); if in_domain.is_ok() && in_domain.unwrap() { // this is a User ID with an email in the domain @@ -190,7 +190,7 @@ fn validate_and_strip_user_ids( // strip unexpected "internal" user_ids from the Cert let mut stripped = cert.clone(); for filter in filter_uid { - stripped = user_id_filter(stripped, &filter) + stripped = user_id_filter(stripped, filter) } Ok(stripped) @@ -264,7 +264,7 @@ fn process_cert( ca: &OpenpgpCa, persist: bool, ) -> Result<ReturnGoodJson, ReturnBadJson> { - let cert_info = check_cert(&cert)?; + let cert_info = check_cert(cert)?; // check if a cert with this fingerprint exists already in db // (new vs update) @@ -375,7 +375,7 @@ fn process_cert( // check and normalize user_ids let norm = validate_and_strip_user_ids( &valid_cert, - &my_domain, + my_domain, &certificate.email, ) .map_err(|e| ReturnBadJson::new(e, Some(cert_info.clone())))?; @@ -591,15 +591,8 @@ pub fn process_certs( .enumerate() .map(|(n, cert)| { let is_signer = Some(n) == signer; - process_cert( - &cert, - is_signer, - &my_domain, - &certificate, - ca, - persist, - ) - .into() + process_cert(cert, is_signer, &my_domain, certificate, ca, persist) + .into() }) .collect()) } diff --git a/openpgp-ca-restd/src/restd.rs b/openpgp-ca-restd/src/restd.rs index 59e8034..0968a78 100644 --- a/openpgp-ca-restd/src/restd.rs +++ b/openpgp-ca-restd/src/restd.rs @@ -45,7 +45,7 @@ fn load_certificate_data( ca: &OpenpgpCa, cert: &models::Cert, ) -> Result<Certificate, ReturnError> { - let user = ca.cert_get_users(&cert).map_err(|e| { + let user = ca.cert_get_users(cert).map_err(|e| { ReturnError::new( ReturnStatus::InternalError, format!( @@ -63,7 +63,7 @@ fn load_certificate_data( )); } - let emails = ca.emails_get(&cert).map_err(|e| { + let emails = ca.emails_get(cert).map_err(|e| { ReturnError::new( ReturnStatus::InternalError, format!( @@ -73,7 +73,7 @@ fn load_certificate_data( ) })?; - let rev = ca.revocations_get(&cert).map_err(|e| { + let rev = ca.revocations_get(cert).map_err(|e| { ReturnError::new( ReturnStatus::InternalError, format!( @@ -84,7 +84,7 @@ fn load_certificate_data( ) })?; - Ok(Certificate::from(&cert, &user.unwrap(), &emails, &rev)) + Ok(Certificate::from(cert, &user.unwrap(), &emails, &rev)) } #[get("/certs/by_email/<email>")] @@ -127,7 +127,7 @@ fn certs_by_email( ) })?; - let certificate = load_certificate_data(&ca, &c)?; + let certificate = load_certificate_data(ca, &c)?; res.push(ReturnGoodJson { certificate, @@ -155,7 +155,7 @@ fn cert_by_fp( })?; if let Some(c) = c { - let certificate = load_certificate_data(&ca, &c)?; + let certificate = load_certificate_data(ca, &c)?; let cert = Pgp::armored_to_cert(&c.pub_cert).map_err(|e| { ReturnError::new( @@ -199,7 +199,7 @@ fn check_certs( certificate: Json<Certificate>, ) -> Result<Json<Vec<CertResultJson>>, BadRequest<Json<ReturnError>>> { CA.with(|ca| { - Ok(Json(process_certs(&ca, &certificate.into_inner(), false)?)) + Ok(Json(process_certs(ca, &certificate.into_inner(), false)?)) }) } @@ -216,9 +216,7 @@ fn check_certs( fn post_certs( certificate: Json<Certificate>, ) -> Result<Json<Vec<CertResultJson>>, BadRequest<Json<ReturnError>>> { - CA.with(|ca| { - Ok(Json(process_certs(&ca, &certificate.into_inner(), true)?)) - }) + CA.with(|ca| Ok(Json(process_certs(ca, &certificate.into_inner(), true)?))) } /// Mark a certificate as "deactivated". |