Skip to content

Commit

Permalink
Merge pull request #146 from dtolnay/complexity
Browse files Browse the repository at this point in the history
Suppress type_complexity lint in generated code
  • Loading branch information
dtolnay committed Mar 5, 2021
2 parents ca91108 + f40ff9a commit 148a18e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
)]
Expand All @@ -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
)]
}
}

Expand Down
15 changes: 15 additions & 0 deletions tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Self::Connection, Self::Error>;
}
}

0 comments on commit 148a18e

Please sign in to comment.