Skip to content

Commit 5f3d1cd

Browse files
authored
Merge pull request #130 from dtolnay/underscore
Suppress used_underscore_binding on wrapper function
2 parents b922a50 + 9a7bb72 commit 5f3d1cd

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/expand.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ pub fn expand(input: &mut Item, is_local: bool) {
7272
if let Some(block) = block {
7373
has_self |= has_self_in_block(block);
7474
transform_block(context, sig, block, has_self, is_local);
75+
method.attrs.push(parse_quote!(#[allow(clippy::used_underscore_binding)]));
7576
}
7677
let has_default = method.default.is_some();
7778
transform_sig(context, sig, has_self, has_default, is_local);
@@ -101,6 +102,7 @@ pub fn expand(input: &mut Item, is_local: bool) {
101102
let has_self = has_self_in_sig(sig) || has_self_in_block(block);
102103
transform_block(context, sig, block, has_self, is_local);
103104
transform_sig(context, sig, has_self, false, is_local);
105+
method.attrs.push(parse_quote!(#[allow(clippy::used_underscore_binding)]));
104106
}
105107
}
106108
}

tests/test.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,3 +1025,26 @@ pub mod issue123 {
10251025
#[async_trait]
10261026
impl<T> Trait<T> for () {}
10271027
}
1028+
1029+
// https://github.com/dtolnay/async-trait/issues/129
1030+
pub mod issue129 {
1031+
#![deny(clippy::pedantic)]
1032+
1033+
use async_trait::async_trait;
1034+
1035+
#[async_trait]
1036+
pub trait TestTrait {
1037+
async fn a(_b: u8, c: u8) -> u8 {
1038+
c
1039+
}
1040+
}
1041+
1042+
pub struct TestStruct;
1043+
1044+
#[async_trait]
1045+
impl TestTrait for TestStruct {
1046+
async fn a(_b: u8, c: u8) -> u8 {
1047+
c
1048+
}
1049+
}
1050+
}

0 commit comments

Comments
 (0)