diff --git a/server/Cargo.toml b/server/Cargo.toml index 05b274f75..443c4406a 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -2,6 +2,9 @@ members = ["svix-server", "svix-server_derive"] resolver = "2" +[workspace.lints.rust] +rust_2018_idioms = "warn" + [workspace.lints.clippy] dbg_macro = "warn" todo = "warn" diff --git a/server/svix-server/src/cfg.rs b/server/svix-server/src/cfg.rs index b44919928..b3a59d941 100644 --- a/server/svix-server/src/cfg.rs +++ b/server/svix-server/src/cfg.rs @@ -352,7 +352,7 @@ pub enum Environment { } impl std::fmt::Display for Environment { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!( f, "{}", diff --git a/server/svix-server/src/core/webhook_http_client.rs b/server/svix-server/src/core/webhook_http_client.rs index 2dbbc7b94..a8bb355e3 100644 --- a/server/svix-server/src/core/webhook_http_client.rs +++ b/server/svix-server/src/core/webhook_http_client.rs @@ -103,7 +103,7 @@ impl WebhookClient { &self, request: Request, retry: bool, - ) -> BoxFuture, Error>> { + ) -> BoxFuture<'_, Result, Error>> { async move { let org_req = request.clone(); if let Some(auth) = request.uri.authority() { diff --git a/server/svix-server/src/error.rs b/server/svix-server/src/error.rs index f33847434..0cf71d3d7 100644 --- a/server/svix-server/src/error.rs +++ b/server/svix-server/src/error.rs @@ -97,7 +97,7 @@ impl Error { } impl fmt::Display for Error { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.typ.fmt(f) } } @@ -229,7 +229,7 @@ pub enum ErrorType { } impl fmt::Display for ErrorType { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Self::Generic(s) => s.fmt(f), Self::Database(s) => s.fmt(f), @@ -372,7 +372,7 @@ impl From for Error { } impl fmt::Display for HttpError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match &self.body { HttpErrorBody::Standard(StandardHttpError { code, detail }) => write!( f, diff --git a/server/svix-server/src/redis/mod.rs b/server/svix-server/src/redis/mod.rs index a484280d1..1afed6932 100644 --- a/server/svix-server/src/redis/mod.rs +++ b/server/svix-server/src/redis/mod.rs @@ -14,7 +14,7 @@ pub enum RedisPool { } impl RedisPool { - pub async fn get(&self) -> Result> { + pub async fn get(&self) -> Result, RunError> { match self { Self::Clustered(pool) => pool.get().await, Self::NonClustered(pool) => pool.get().await, @@ -28,7 +28,7 @@ pub struct ClusteredRedisPool { } impl ClusteredRedisPool { - pub async fn get(&self) -> Result> { + pub async fn get(&self) -> Result, RunError> { let con = ClusteredPooledConnection { con: self.pool.get().await?, }; @@ -42,7 +42,7 @@ pub struct NonClusteredRedisPool { } impl NonClusteredRedisPool { - pub async fn get(&self) -> Result> { + pub async fn get(&self) -> Result, RunError> { let con = self.pool.get().await?; let con = NonClusteredPooledConnection { con }; Ok(PooledConnection::NonClustered(con)) diff --git a/server/svix-server/src/v1/endpoints/auth.rs b/server/svix-server/src/v1/endpoints/auth.rs index 9ba3dbd13..4e44cb8dc 100644 --- a/server/svix-server/src/v1/endpoints/auth.rs +++ b/server/svix-server/src/v1/endpoints/auth.rs @@ -119,7 +119,7 @@ Logout an app token. Trying to log out other tokens will fail. "#; -fn logout_operation(op: TransformOperation) -> TransformOperation { +fn logout_operation(op: TransformOperation<'_>) -> TransformOperation<'_> { op.id("logout_api_v1_auth_logout__post") .summary("Logout") .description(LOGOUT_DESCRIPTION) diff --git a/server/svix-server/src/v1/utils/mod.rs b/server/svix-server/src/v1/utils/mod.rs index 4b0ab4984..380bfa90b 100644 --- a/server/svix-server/src/v1/utils/mod.rs +++ b/server/svix-server/src/v1/utils/mod.rs @@ -630,11 +630,15 @@ pub fn validate_no_control_characters_unrequired( } } -pub fn openapi_tag>(tag: T) -> impl Fn(TransformPathItem) -> TransformPathItem { +pub fn openapi_tag>( + tag: T, +) -> impl Fn(TransformPathItem<'_>) -> TransformPathItem<'_> { move |op| op.tag(tag.as_ref()) } -pub fn openapi_desc>(desc: T) -> impl Fn(TransformOperation) -> TransformOperation { +pub fn openapi_desc>( + desc: T, +) -> impl Fn(TransformOperation<'_>) -> TransformOperation<'_> { move |op| op.description(desc.as_ref()) }