@@ -224,6 +224,11 @@ impl ToTokens for ast::Struct {
224
224
let free_fn = Ident :: new ( & shared:: free_function ( & name_str) , Span :: call_site ( ) ) ;
225
225
let unwrap_fn = Ident :: new ( & shared:: unwrap_function ( & name_str) , Span :: call_site ( ) ) ;
226
226
let wasm_bindgen = & self . wasm_bindgen ;
227
+ let maybe_no_coverage = if cfg ! ( wasm_bindgen_unstable_test_coverage) {
228
+ Some ( quote ! { #[ coverage( off) ] } )
229
+ } else {
230
+ None
231
+ } ;
227
232
( quote ! {
228
233
#[ automatically_derived]
229
234
impl #wasm_bindgen:: describe:: WasmDescribe for #name {
@@ -300,7 +305,7 @@ impl ToTokens for ast::Struct {
300
305
#[ doc( hidden) ]
301
306
// `allow_delayed` is whether it's ok to not actually free the `ptr` immediately
302
307
// if it's still borrowed.
303
- #[ cfg_attr ( wasm_bindgen_unstable_test_coverage , coverage ( off ) ) ]
308
+ #maybe_no_coverage
304
309
pub unsafe extern "C" fn #free_fn( ptr: u32 , allow_delayed: u32 ) {
305
310
use #wasm_bindgen:: __rt:: alloc:: rc:: Rc ;
306
311
@@ -476,6 +481,11 @@ impl ToTokens for ast::StructField {
476
481
quote ! { assert_copy:: <#ty>( ) }
477
482
} ;
478
483
let maybe_assert_copy = respan ( maybe_assert_copy, ty) ;
484
+ let maybe_no_coverage = if cfg ! ( wasm_bindgen_unstable_test_coverage) {
485
+ Some ( quote ! { #[ coverage( off) ] } )
486
+ } else {
487
+ None
488
+ } ;
479
489
480
490
// Split this out so that it isn't affected by `quote_spanned!`.
481
491
//
@@ -496,7 +506,7 @@ impl ToTokens for ast::StructField {
496
506
const _: ( ) = {
497
507
#[ cfg_attr( all( target_arch = "wasm32" , any( target_os = "unknown" , target_os = "none" ) ) , no_mangle) ]
498
508
#[ doc( hidden) ]
499
- #[ cfg_attr ( wasm_bindgen_unstable_test_coverage , coverage ( off ) ) ]
509
+ #maybe_no_coverage
500
510
pub unsafe extern "C" fn #getter( js: u32 )
501
511
-> #wasm_bindgen:: convert:: WasmRet <<#ty as #wasm_bindgen:: convert:: IntoWasmAbi >:: Abi >
502
512
{
@@ -538,7 +548,7 @@ impl ToTokens for ast::StructField {
538
548
const _: ( ) = {
539
549
#[ no_mangle]
540
550
#[ doc( hidden) ]
541
- #[ cfg_attr ( wasm_bindgen_unstable_test_coverage , coverage ( off ) ) ]
551
+ #maybe_no_coverage
542
552
pub unsafe extern "C" fn #setter(
543
553
js: u32 ,
544
554
#( #args, ) *
@@ -787,6 +797,12 @@ impl TryToTokens for ast::Export {
787
797
quote ! { }
788
798
} ;
789
799
800
+ let maybe_no_coverage = if cfg ! ( wasm_bindgen_unstable_test_coverage) {
801
+ Some ( quote ! { #[ coverage( off) ] } )
802
+ } else {
803
+ None
804
+ } ;
805
+
790
806
( quote ! {
791
807
#[ automatically_derived]
792
808
const _: ( ) = {
@@ -795,7 +811,7 @@ impl TryToTokens for ast::Export {
795
811
all( target_arch = "wasm32" , any( target_os = "unknown" , target_os = "none" ) ) ,
796
812
export_name = #export_name,
797
813
) ]
798
- #[ cfg_attr ( wasm_bindgen_unstable_test_coverage , coverage ( off ) ) ]
814
+ #maybe_no_coverage
799
815
pub unsafe extern "C" fn #generated_name( #( #args) , * ) -> #wasm_bindgen:: convert:: WasmRet <#projection:: Abi > {
800
816
#start_check
801
817
@@ -1156,6 +1172,12 @@ impl ToTokens for ast::StringEnum {
1156
1172
let hole = variant_count + 1 ;
1157
1173
let attrs = & self . rust_attrs ;
1158
1174
1175
+ let maybe_no_coverage = if cfg ! ( wasm_bindgen_unstable_test_coverage) {
1176
+ Some ( quote ! { #[ coverage( off) ] } )
1177
+ } else {
1178
+ None
1179
+ } ;
1180
+
1159
1181
let invalid_to_str_msg = format ! (
1160
1182
"Converting an invalid string enum ({}) back to a string is currently not supported" ,
1161
1183
enum_name
@@ -1242,7 +1264,7 @@ impl ToTokens for ast::StringEnum {
1242
1264
1243
1265
#[ automatically_derived]
1244
1266
impl #wasm_bindgen:: describe:: WasmDescribe for #enum_name {
1245
- #[ cfg_attr ( wasm_bindgen_unstable_test_coverage , coverage ( off ) ) ]
1267
+ #maybe_no_coverage
1246
1268
fn describe( ) {
1247
1269
use #wasm_bindgen:: describe:: * ;
1248
1270
inform( STRING_ENUM ) ;
@@ -1536,6 +1558,11 @@ impl ToTokens for ast::Enum {
1536
1558
let name_len = name_str. len ( ) as u32 ;
1537
1559
let name_chars = name_str. chars ( ) . map ( |c| c as u32 ) ;
1538
1560
let hole = & self . hole ;
1561
+ let maybe_no_coverage = if cfg ! ( wasm_bindgen_unstable_test_coverage) {
1562
+ Some ( quote ! { #[ coverage( off) ] } )
1563
+ } else {
1564
+ None
1565
+ } ;
1539
1566
let underlying = if self . signed {
1540
1567
quote ! { i32 }
1541
1568
} else {
@@ -1588,7 +1615,7 @@ impl ToTokens for ast::Enum {
1588
1615
1589
1616
#[ automatically_derived]
1590
1617
impl #wasm_bindgen:: describe:: WasmDescribe for #enum_name {
1591
- #[ cfg_attr ( wasm_bindgen_unstable_test_coverage , coverage ( off ) ) ]
1618
+ #maybe_no_coverage
1592
1619
fn describe( ) {
1593
1620
use #wasm_bindgen:: describe:: * ;
1594
1621
inform( ENUM ) ;
@@ -1853,6 +1880,12 @@ impl<'a, T: ToTokens> ToTokens for Descriptor<'a, T> {
1853
1880
return ;
1854
1881
}
1855
1882
1883
+ let maybe_no_coverage = if cfg ! ( wasm_bindgen_unstable_test_coverage) {
1884
+ Some ( quote ! { #[ coverage( off) ] } )
1885
+ } else {
1886
+ None
1887
+ } ;
1888
+
1856
1889
let name = Ident :: new ( & format ! ( "__wbindgen_describe_{}" , ident) , ident. span ( ) ) ;
1857
1890
let inner = & self . inner ;
1858
1891
let attrs = & self . attrs ;
@@ -1864,7 +1897,7 @@ impl<'a, T: ToTokens> ToTokens for Descriptor<'a, T> {
1864
1897
#( #attrs) *
1865
1898
#[ no_mangle]
1866
1899
#[ doc( hidden) ]
1867
- #[ cfg_attr ( wasm_bindgen_unstable_test_coverage , coverage ( off ) ) ]
1900
+ #maybe_no_coverage
1868
1901
pub extern "C" fn #name( ) {
1869
1902
use #wasm_bindgen:: describe:: * ;
1870
1903
// See definition of `link_mem_intrinsics` for what this is doing
0 commit comments