File tree Expand file tree Collapse file tree 3 files changed +12
-12
lines changed Expand file tree Collapse file tree 3 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -2,9 +2,11 @@ use std::{fs, hint::black_box};
22
33use criterion:: { Criterion , criterion_group, criterion_main} ;
44
5+ #[ cfg( not( feature = "codspeed" ) ) ]
56use generic:: escape_generic;
67use json_escape_simd:: escape;
78
9+ #[ cfg( not( feature = "codspeed" ) ) ]
810mod generic;
911
1012fn get_rxjs_sources ( ) -> Vec < String > {
Original file line number Diff line number Diff line change @@ -563,9 +563,9 @@ mod tests {
563563 . iter ( )
564564 . take ( if cfg ! ( miri) { 10 } else { sources. len ( ) } )
565565 {
566- assert_eq ! ( escape( & source) , serde_json:: to_string( & source) . unwrap( ) ) ;
566+ assert_eq ! ( escape( source) , serde_json:: to_string( & source) . unwrap( ) ) ;
567567 let mut output = String :: new ( ) ;
568- escape_into ( & source, unsafe { output. as_mut_vec ( ) } ) ;
568+ escape_into ( source, unsafe { output. as_mut_vec ( ) } ) ;
569569 assert_eq ! ( output, serde_json:: to_string( & source) . unwrap( ) ) ;
570570 }
571571 }
@@ -603,10 +603,8 @@ mod tests {
603603 for entry in dir {
604604 let p = entry?;
605605 let metadata = std:: fs:: metadata ( p. path ( ) ) ?;
606- if metadata. is_file ( ) {
607- if f ( p. path ( ) ) {
608- sources. push ( std:: fs:: read_to_string ( p. path ( ) ) ?) ;
609- }
606+ if metadata. is_file ( ) && f ( p. path ( ) ) {
607+ sources. push ( std:: fs:: read_to_string ( p. path ( ) ) ?) ;
610608 }
611609 if metadata. is_dir ( ) {
612610 read_dir_recursive ( p. path ( ) , sources, f) ?;
Original file line number Diff line number Diff line change @@ -42,8 +42,8 @@ impl Simd for Simd128u {
4242
4343 fn le ( & self , rhs : & Self ) -> Self :: Mask {
4444 let mut mask = [ 0u8 ; 16 ] ;
45- for i in 0 .. Self :: LANES {
46- mask [ i ] = if self . 0 [ i] <= rhs. 0 [ i] { 1 } else { 0 } ;
45+ for ( i , item ) in mask . iter_mut ( ) . enumerate ( ) . take ( Self :: LANES ) {
46+ * item = if self . 0 [ i] <= rhs. 0 [ i] { 1 } else { 0 } ;
4747 }
4848 Mask128 ( mask)
4949 }
@@ -76,8 +76,8 @@ impl BitAnd for Mask128 {
7676
7777 fn bitand ( self , rhs : Self ) -> Self :: Output {
7878 let mut result = [ 0u8 ; 16 ] ;
79- for i in 0 .. 16 {
80- result [ i ] = self . 0 [ i] & rhs. 0 [ i] ;
79+ for ( i , item ) in result . iter_mut ( ) . enumerate ( ) {
80+ * item = self . 0 [ i] & rhs. 0 [ i] ;
8181 }
8282 Mask128 ( result)
8383 }
@@ -88,8 +88,8 @@ impl BitOr for Mask128 {
8888
8989 fn bitor ( self , rhs : Self ) -> Self :: Output {
9090 let mut result = [ 0u8 ; 16 ] ;
91- for i in 0 .. 16 {
92- result [ i ] = self . 0 [ i] | rhs. 0 [ i] ;
91+ for ( i , item ) in result . iter_mut ( ) . enumerate ( ) {
92+ * item = self . 0 [ i] | rhs. 0 [ i] ;
9393 }
9494 Mask128 ( result)
9595 }
You can’t perform that action at this time.
0 commit comments