From c732402c21a6b2459588ff0c9633854a4b6b47f7 Mon Sep 17 00:00:00 2001 From: pennae Date: Sun, 17 Jul 2022 17:22:56 +0200 Subject: fix clippy warnings --- src/api/auth/invite.rs | 6 +++--- src/api/profile/mod.rs | 1 + src/crypto.rs | 1 + src/mailer.rs | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/api/auth/invite.rs b/src/api/auth/invite.rs index dd81540..f2c6ad8 100644 --- a/src/api/auth/invite.rs +++ b/src/api/auth/invite.rs @@ -14,8 +14,8 @@ pub(crate) async fn generate_invite_link( ) -> anyhow::Result> { let code = base64::encode_config(&SecretBytes::<32>::generate().0, URL_SAFE_NO_PAD); db.add_invite_code(&code, Utc::now() + ttl).await?; - Ok(Reference::parse_owned(format!("{}/#/register/{}", cfg.location, code)) - .map_err(|e| anyhow!("url building failed at {e}"))?) + Reference::parse_owned(format!("{}/#/register/{}", cfg.location, code)) + .map_err(|e| anyhow!("url building failed at {e}")) } #[derive(Debug, Deserialize)] @@ -42,6 +42,6 @@ pub(crate) async fn generate( if user.email != cfg.invite_admin_address { return Err(auth::Error::InvalidAuthToken); } - let url = generate_invite_link(&db, &cfg, Duration::hours(req.body.ttl_hours as i64)).await?; + let url = generate_invite_link(db, cfg, Duration::hours(req.body.ttl_hours as i64)).await?; Ok(Json(GenerateResp { url })) } diff --git a/src/api/profile/mod.rs b/src/api/profile/mod.rs index 28d1e03..da9c87f 100644 --- a/src/api/profile/mod.rs +++ b/src/api/profile/mod.rs @@ -256,6 +256,7 @@ pub(crate) struct AvatarUploadResp { } #[post("/avatar/upload", data = "")] +#[allow(clippy::too_many_arguments)] pub(crate) async fn avatar_upload( db: &DbConn, db_pool: &Db, diff --git a/src/crypto.rs b/src/crypto.rs index 4b379de..049f6b0 100644 --- a/src/crypto.rs +++ b/src/crypto.rs @@ -3,6 +3,7 @@ #![allow(clippy::blanket_clippy_restriction_lints)] #![allow(clippy::implicit_return)] #![allow(clippy::missing_docs_in_private_items)] +#![allow(clippy::missing_inline_in_public_items)] #![allow(clippy::shadow_reuse)] use std::fmt::Debug; diff --git a/src/mailer.rs b/src/mailer.rs index 1ea1a8b..18f89b0 100644 --- a/src/mailer.rs +++ b/src/mailer.rs @@ -62,7 +62,7 @@ impl Mailer { .from(self.from.clone()) .to(to.parse()?) .subject("session verify code") - .body(format!("{code}"))?; + .body(code.to_string())?; lettre::AsyncTransport::send(&self.transport, email).await?; Ok(()) } -- cgit v1.2.3