Skip to content

Commit 0c2e108

Browse files
authored
Merge pull request #284 from dtolnay/selfinblock
Omit `Self: 'async_trait` bound in impl when not needed by signature
2 parents 4c8406d + 9456e54 commit 0c2e108

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/expand.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ pub fn expand(input: &mut Item, is_local: bool) {
9999
ImplItem::Fn(method) if method.sig.asyncness.is_some() => {
100100
let sig = &mut method.sig;
101101
let block = &mut method.block;
102-
let has_self = has_self_in_sig(sig) || has_self_in_block(block);
102+
let has_self = has_self_in_sig(sig);
103103
transform_block(context, sig, block);
104104
transform_sig(context, sig, has_self, false, is_local);
105105
method.attrs.push(lint_suppress_with_body());

tests/test.rs

+20
Original file line numberDiff line numberDiff line change
@@ -1683,3 +1683,23 @@ pub mod issue281 {
16831683
}
16841684
}
16851685
}
1686+
1687+
pub mod issue283 {
1688+
use async_trait::async_trait;
1689+
1690+
#[async_trait]
1691+
pub trait Trait {
1692+
async fn a();
1693+
}
1694+
1695+
pub trait Bound {
1696+
fn b();
1697+
}
1698+
1699+
#[async_trait]
1700+
impl<T: Bound> Trait for T {
1701+
async fn a() {
1702+
Self::b();
1703+
}
1704+
}
1705+
}

0 commit comments

Comments
 (0)