@@ -7,7 +7,7 @@ use string_enum::StringEnum;
7
7
use swc_common:: collections:: AHashMap ;
8
8
9
9
impl Feature {
10
- pub fn should_enable ( self , target : Versions , bugfixes : bool , default : bool ) -> bool {
10
+ pub fn should_enable ( self , target : & Versions , bugfixes : bool , default : bool ) -> bool {
11
11
let f = if bugfixes {
12
12
& BUGFIX_FEATURES [ & self ]
13
13
} else {
@@ -17,7 +17,7 @@ impl Feature {
17
17
& FEATURES [ & self ]
18
18
} ;
19
19
20
- should_enable ( target, * f, default)
20
+ should_enable ( target, f, default)
21
21
}
22
22
}
23
23
@@ -256,7 +256,7 @@ mod tests {
256
256
#[ test]
257
257
fn arrow ( ) {
258
258
assert ! ( Feature :: ArrowFunctions . should_enable(
259
- BrowserData {
259
+ & BrowserData {
260
260
ie: Some ( "11.0.0" . parse( ) . unwrap( ) ) ,
261
261
..Default :: default ( )
262
262
} ,
@@ -268,7 +268,7 @@ mod tests {
268
268
#[ test]
269
269
fn tpl_lit ( ) {
270
270
assert ! ( !Feature :: TemplateLiterals . should_enable(
271
- BrowserData {
271
+ & BrowserData {
272
272
chrome: Some ( "71.0.0" . parse( ) . unwrap( ) ) ,
273
273
..Default :: default ( )
274
274
} ,
@@ -281,7 +281,7 @@ mod tests {
281
281
fn tpl_lit_bugfixes ( ) {
282
282
// Enable template literals pass in Safari 9 without bugfixes option
283
283
assert ! ( Feature :: TemplateLiterals . should_enable(
284
- BrowserData {
284
+ & BrowserData {
285
285
safari: Some ( "9.0.0" . parse( ) . unwrap( ) ) ,
286
286
..Default :: default ( )
287
287
} ,
@@ -290,7 +290,7 @@ mod tests {
290
290
) ) ;
291
291
292
292
assert ! ( !Feature :: BugfixTaggedTemplateCaching . should_enable(
293
- BrowserData {
293
+ & BrowserData {
294
294
safari: Some ( "10.0.0" . parse( ) . unwrap( ) ) ,
295
295
..Default :: default ( )
296
296
} ,
@@ -300,7 +300,7 @@ mod tests {
300
300
301
301
// Don't enable it with the bugfixes option. Bugfix pass enabled instead.
302
302
assert ! ( !Feature :: TemplateLiterals . should_enable(
303
- BrowserData {
303
+ & BrowserData {
304
304
safari: Some ( "9.0.0" . parse( ) . unwrap( ) ) ,
305
305
..Default :: default ( )
306
306
} ,
@@ -309,7 +309,7 @@ mod tests {
309
309
) ) ;
310
310
311
311
assert ! ( Feature :: BugfixTaggedTemplateCaching . should_enable(
312
- BrowserData {
312
+ & BrowserData {
313
313
safari: Some ( "9.0.0" . parse( ) . unwrap( ) ) ,
314
314
..Default :: default ( )
315
315
} ,
@@ -318,7 +318,7 @@ mod tests {
318
318
) ) ;
319
319
320
320
assert ! ( !Feature :: BugfixTaggedTemplateCaching . should_enable(
321
- BrowserData {
321
+ & BrowserData {
322
322
safari: Some ( "13.0.0" . parse( ) . unwrap( ) ) ,
323
323
..Default :: default ( )
324
324
} ,
@@ -331,7 +331,7 @@ mod tests {
331
331
fn edge_default_param_bug ( ) {
332
332
// Enable params pass in Edge 17 without bugfixes option
333
333
assert ! ( Feature :: Parameters . should_enable(
334
- BrowserData {
334
+ & BrowserData {
335
335
edge: Some ( "17.0.0" . parse( ) . unwrap( ) ) ,
336
336
..Default :: default ( )
337
337
} ,
@@ -340,7 +340,7 @@ mod tests {
340
340
) ) ;
341
341
342
342
assert ! ( !Feature :: BugfixEdgeDefaultParam . should_enable(
343
- BrowserData {
343
+ & BrowserData {
344
344
edge: Some ( "17.0.0" . parse( ) . unwrap( ) ) ,
345
345
..Default :: default ( )
346
346
} ,
@@ -350,7 +350,7 @@ mod tests {
350
350
351
351
// Don't enable it with the bugfixes option. Bugfix pass enabled instead.
352
352
assert ! ( !Feature :: Parameters . should_enable(
353
- BrowserData {
353
+ & BrowserData {
354
354
edge: Some ( "17.0.0" . parse( ) . unwrap( ) ) ,
355
355
..Default :: default ( )
356
356
} ,
@@ -359,7 +359,7 @@ mod tests {
359
359
) ) ;
360
360
361
361
assert ! ( Feature :: BugfixEdgeDefaultParam . should_enable(
362
- BrowserData {
362
+ & BrowserData {
363
363
edge: Some ( "17.0.0" . parse( ) . unwrap( ) ) ,
364
364
..Default :: default ( )
365
365
} ,
@@ -368,7 +368,7 @@ mod tests {
368
368
) ) ;
369
369
370
370
assert ! ( !Feature :: BugfixEdgeDefaultParam . should_enable(
371
- BrowserData {
371
+ & BrowserData {
372
372
edge: Some ( "18.0.0" . parse( ) . unwrap( ) ) ,
373
373
..Default :: default ( )
374
374
} ,
@@ -381,7 +381,7 @@ mod tests {
381
381
fn async_arrows_in_class_bug ( ) {
382
382
// Enable async to generator pass in Safari 10.1 without bugfixes option
383
383
assert ! ( Feature :: AsyncToGenerator . should_enable(
384
- BrowserData {
384
+ & BrowserData {
385
385
safari: Some ( "10.1.0" . parse( ) . unwrap( ) ) ,
386
386
..Default :: default ( )
387
387
} ,
@@ -390,7 +390,7 @@ mod tests {
390
390
) ) ;
391
391
392
392
assert ! ( !Feature :: BugfixAsyncArrowsInClass . should_enable(
393
- BrowserData {
393
+ & BrowserData {
394
394
safari: Some ( "10.1.0" . parse( ) . unwrap( ) ) ,
395
395
..Default :: default ( )
396
396
} ,
@@ -400,7 +400,7 @@ mod tests {
400
400
401
401
// Don't enable it with the bugfixes option. Bugfix pass enabled instead.
402
402
assert ! ( !Feature :: AsyncToGenerator . should_enable(
403
- BrowserData {
403
+ & BrowserData {
404
404
safari: Some ( "10.1.0" . parse( ) . unwrap( ) ) ,
405
405
..Default :: default ( )
406
406
} ,
@@ -409,7 +409,7 @@ mod tests {
409
409
) ) ;
410
410
411
411
assert ! ( Feature :: BugfixAsyncArrowsInClass . should_enable(
412
- BrowserData {
412
+ & BrowserData {
413
413
safari: Some ( "10.1.0" . parse( ) . unwrap( ) ) ,
414
414
..Default :: default ( )
415
415
} ,
@@ -418,7 +418,7 @@ mod tests {
418
418
) ) ;
419
419
420
420
assert ! ( !Feature :: BugfixAsyncArrowsInClass . should_enable(
421
- BrowserData {
421
+ & BrowserData {
422
422
safari: Some ( "11.1.0" . parse( ) . unwrap( ) ) ,
423
423
..Default :: default ( )
424
424
} ,
@@ -431,7 +431,7 @@ mod tests {
431
431
fn block_scoping ( ) {
432
432
// Enable block scoping pass in Safari 10 without bugfixes option
433
433
assert ! ( Feature :: BlockScoping . should_enable(
434
- BrowserData {
434
+ & BrowserData {
435
435
safari: Some ( "10.0.0" . parse( ) . unwrap( ) ) ,
436
436
..Default :: default ( )
437
437
} ,
@@ -441,7 +441,7 @@ mod tests {
441
441
442
442
// Don't enable it with the bugfixes option.
443
443
assert ! ( !Feature :: BlockScoping . should_enable(
444
- BrowserData {
444
+ & BrowserData {
445
445
safari: Some ( "10.0.0" . parse( ) . unwrap( ) ) ,
446
446
..Default :: default ( )
447
447
} ,
0 commit comments