From 2ac95f3df686c66718b9aa7a4eac4b3bf9a5762d Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Thu, 4 Mar 2021 23:26:20 -0800 Subject: [PATCH 1/2] Add regression test for issue 145 --- tests/test.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/test.rs b/tests/test.rs index f36d19a..e8db9f7 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -1218,3 +1218,18 @@ pub mod drop_order { assert!(!flag.load(Ordering::Acquire)); } } + +// https://github.com/dtolnay/async-trait/issues/145 +pub mod issue145 { + #![deny(clippy::type_complexity)] + + use async_trait::async_trait; + + #[async_trait] + pub trait ManageConnection: Sized + Send + Sync + 'static { + type Connection: Send + 'static; + type Error: Send + 'static; + + async fn connect(&self) -> Result; + } +} From f40ff9a58c2f49ef99aa6d87ce08f4638433e187 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Thu, 4 Mar 2021 23:32:50 -0800 Subject: [PATCH 2/2] Suppress type_complexity lint in generated code --- src/expand.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/expand.rs b/src/expand.rs index e1c8391..a579114 100644 --- a/src/expand.rs +++ b/src/expand.rs @@ -112,6 +112,7 @@ pub fn expand(input: &mut Item, is_local: bool) { fn lint_suppress_with_body() -> Attribute { parse_quote! { #[allow( + clippy::type_complexity, clippy::type_repetition_in_bounds, clippy::used_underscore_binding )] @@ -120,7 +121,10 @@ fn lint_suppress_with_body() -> Attribute { fn lint_suppress_without_body() -> Attribute { parse_quote! { - #[allow(clippy::type_repetition_in_bounds)] + #[allow( + clippy::type_complexity, + clippy::type_repetition_in_bounds + )] } }