File tree Expand file tree Collapse file tree 2 files changed +36
-14
lines changed Expand file tree Collapse file tree 2 files changed +36
-14
lines changed Original file line number Diff line number Diff line change @@ -112,6 +112,7 @@ pub fn expand(input: &mut Item, is_local: bool) {
112
112
fn lint_suppress_with_body ( ) -> Attribute {
113
113
parse_quote ! {
114
114
#[ allow(
115
+ clippy:: let_unit_value,
115
116
clippy:: type_complexity,
116
117
clippy:: type_repetition_in_bounds,
117
118
clippy:: used_underscore_binding
@@ -344,23 +345,19 @@ fn transform_block(sig: &mut Signature, block: &mut Block) {
344
345
}
345
346
346
347
let stmts = & block. stmts ;
347
- let ret_ty = match & sig. output {
348
- ReturnType :: Default => quote_spanned ! ( block. brace_token. span=> ( ) ) ,
349
- ReturnType :: Type ( _, ret) => quote ! ( #ret) ,
350
- } ;
351
-
352
- let box_pin = quote_spanned ! ( block. brace_token. span=>
353
- Box :: pin( async move {
354
- let __ret: #ret_ty = {
355
- #( #decls) *
356
- #( #stmts) *
357
- } ;
358
-
348
+ let let_ret = match & sig. output {
349
+ ReturnType :: Default => quote_spanned ! { block. brace_token. span=>
350
+ let _: ( ) = { #( #decls) * #( #stmts) * } ;
351
+ } ,
352
+ ReturnType :: Type ( _, ret) => quote_spanned ! { block. brace_token. span=>
353
+ let __ret: #ret = { #( #decls) * #( #stmts) * } ;
359
354
#[ allow( unreachable_code) ]
360
355
__ret
361
- } )
356
+ } ,
357
+ } ;
358
+ let box_pin = quote_spanned ! ( block. brace_token. span=>
359
+ Box :: pin( async move { #let_ret } )
362
360
) ;
363
-
364
361
block. stmts = parse_quote ! ( #box_pin) ;
365
362
}
366
363
Original file line number Diff line number Diff line change @@ -1233,3 +1233,28 @@ pub mod issue145 {
1233
1233
async fn connect ( & self ) -> Result < Self :: Connection , Self :: Error > ;
1234
1234
}
1235
1235
}
1236
+
1237
+ // https://github.com/dtolnay/async-trait/issues/147
1238
+ pub mod issue147 {
1239
+ #![ deny( clippy:: let_unit_value) ]
1240
+
1241
+ use async_trait:: async_trait;
1242
+
1243
+ pub struct MyType ;
1244
+
1245
+ #[ async_trait]
1246
+ pub trait MyTrait {
1247
+ async fn x ( ) ;
1248
+ async fn y ( ) -> ( ) ;
1249
+ async fn z ( ) ;
1250
+ }
1251
+
1252
+ #[ async_trait]
1253
+ impl MyTrait for MyType {
1254
+ async fn x ( ) { }
1255
+ async fn y ( ) -> ( ) { }
1256
+ async fn z ( ) {
1257
+ unimplemented ! ( )
1258
+ }
1259
+ }
1260
+ }
You can’t perform that action at this time.
0 commit comments