Skip to content

Commit

Permalink
Merge pull request #111 from dtolnay/needless_lifetimes
Browse files Browse the repository at this point in the history
Add some more clippy suppressions to generated code
  • Loading branch information
dtolnay authored Jun 19, 2020
2 parents 79f9aa2 + 8c12924 commit 674e051
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,11 @@ jobs:
- run: cargo test
env:
RUSTFLAGS: ${{matrix.rustflags}}

clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@clippy
- run: cargo clippy --tests -- -Dclippy::all
2 changes: 2 additions & 0 deletions src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,8 @@ fn transform_block(
#[allow(
#allow_non_snake_case
clippy::missing_docs_in_private_items,
clippy::needless_lifetimes,
clippy::ptr_arg,
clippy::type_repetition_in_bounds,
clippy::used_underscore_binding,
)]
Expand Down
25 changes: 23 additions & 2 deletions tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ pub mod issue92 {
const ASSOCIATED2: &'static str;
type Associated2;

#[allow(path_statements)]
#[allow(path_statements, clippy::no_effect)]
async fn associated2(&self) {
// trait items
mac!(let _: Self::Associated2;);
Expand All @@ -849,7 +849,7 @@ pub mod issue92 {
const ASSOCIATED2: &'static str = "2";
type Associated2 = ();

#[allow(path_statements)]
#[allow(path_statements, clippy::no_effect)]
async fn associated2(&self) {
// inherent items
mac!(Self::ASSOCIATED1;);
Expand Down Expand Up @@ -937,3 +937,24 @@ mod issue106 {
}
}
}

// https://github.com/dtolnay/async-trait/issues/110
mod issue110 {
#![deny(clippy::all)]

use std::marker::PhantomData;

#[async_trait::async_trait]
pub trait Loader {
async fn load(&self, key: &str);
}

pub struct AwsEc2MetadataLoader<'a> {
marker: PhantomData<&'a ()>,
}

#[async_trait::async_trait]
impl Loader for AwsEc2MetadataLoader<'_> {
async fn load(&self, _key: &str) {}
}
}

0 comments on commit 674e051

Please sign in to comment.