9
9
//! See [`serde_closure`](https://docs.rs/serde_closure/) for
10
10
//! documentation.
11
11
12
- #![ doc( html_root_url = "https://docs.rs/serde_closure_derive/0.2.9 " ) ]
12
+ #![ doc( html_root_url = "https://docs.rs/serde_closure_derive/0.2.10 " ) ]
13
13
#![ feature( proc_macro_diagnostic) ]
14
14
#![ allow( non_snake_case) ] // due to proc-macro-hack can't apply this directly
15
15
@@ -261,6 +261,7 @@ fn impl_fn_once(closure: Closure, kind: Kind) -> Result<TokenStream, Error> {
261
261
Ok ( quote ! {
262
262
{
263
263
mod #impls_name {
264
+ #![ allow( warnings) ]
264
265
use :: serde_closure:: {
265
266
internal:: { self , is_phantom, to_phantom} ,
266
267
structs,
@@ -420,12 +421,16 @@ fn impl_fn_once(closure: Closure, kind: Kind) -> Result<TokenStream, Error> {
420
421
}
421
422
422
423
// This asserts that inferred env variables aren't nameable types.
424
+ #[ allow( warnings) ]
423
425
{
424
426
#( let #env_variables = :: serde_closure:: internal:: a_variable; ) *
425
427
}
426
428
// This asserts that inferred env variables aren't types with >=1 type parameters.
427
- if false {
428
- #( & #env_variables:: <>; ) *
429
+ #[ allow( warnings) ]
430
+ {
431
+ if false {
432
+ #( & #env_variables:: <>; ) *
433
+ }
429
434
}
430
435
// TODO: Work out how to assert env variables aren't unnameable types with 0 type parameters.
431
436
// This might work in the future, but today it causes borrowck issues:
@@ -442,19 +447,24 @@ fn impl_fn_once(closure: Closure, kind: Kind) -> Result<TokenStream, Error> {
442
447
443
448
let closure =
444
449
#( #attrs) * #asyncness move |mut #env_name: #env_type, ( #( #input_pats, ) * ) : ( #( #input_types, ) * ) | #output {
445
- if false {
446
- :: serde_closure:: internal:: is_phantom( & #env_deref, #env_types_name) ;
450
+ #[ allow( warnings) ]
451
+ {
452
+ if false {
453
+ :: serde_closure:: internal:: is_phantom( & #env_deref, #env_types_name) ;
454
+ }
447
455
}
448
456
#env_deconstruct
449
457
#body
450
458
} ;
451
459
452
- if false {
453
- #[ allow( unreachable_code) ]
454
- let _ = closure( #ret_ref, loop { } ) ;
455
- }
456
- if false {
457
- let :: serde_closure:: internal:: ZeroSizedAssertion = unsafe { :: serde_closure:: internal:: core:: mem:: transmute( closure) } ;
460
+ #[ allow( warnings) ]
461
+ {
462
+ if false {
463
+ let _ = closure( #ret_ref, loop { } ) ;
464
+ }
465
+ if false {
466
+ let :: serde_closure:: internal:: ZeroSizedAssertion = unsafe { :: serde_closure:: internal:: core:: mem:: transmute( closure) } ;
467
+ }
458
468
}
459
469
460
470
:: serde_closure:: structs:: #name:: internal_new( #ret_name. with_f( closure) )
@@ -580,7 +590,10 @@ impl<'a> State<'a> {
580
590
let not_env_variables = take ( self . not_env_variables ) . into_iter ( ) ;
581
591
let mut vec = Vec :: with_capacity ( 2 ) ;
582
592
if not_env_variables. len ( ) != 0 {
583
- vec. push ( parse2 ( quote ! { { #( use #not_env_variables; ) * } } ) . unwrap ( ) ) ;
593
+ vec. push (
594
+ parse2 ( quote ! { #[ allow( warnings) ] { #( use #not_env_variables; ) * } } )
595
+ . unwrap ( ) ,
596
+ ) ;
584
597
}
585
598
vec. push ( stmt) ;
586
599
vec
0 commit comments