File tree 1 file changed +2
-2
lines changed
crates/starknet-types-core/src/felt
1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -1076,7 +1076,7 @@ mod test {
1076
1076
// Helper function to generate a vector of bits for testing purposes
1077
1077
fn generate_be_bits ( x : & Felt ) -> Vec < bool > {
1078
1078
// Initialize an empty vector to store the expected bits
1079
- let mut bits = Vec :: new ( ) ;
1079
+ let mut bits = Vec :: with_capacity ( x . 0 . representative ( ) . limbs . len ( ) * 8 * 8 ) ;
1080
1080
1081
1081
// Iterate over each limb in the representative of x
1082
1082
for limb in x. 0 . representative ( ) . limbs {
@@ -1831,7 +1831,7 @@ mod test {
1831
1831
bytes[ 31 - ( i >> 1 ) ] |= 15 << ( 4 * ( i & 1 ) ) ;
1832
1832
}
1833
1833
let h = Felt :: from_bytes_be ( & bytes) ;
1834
- let mut res = Vec :: new ( ) ;
1834
+ let mut res = Vec :: with_capacity ( enc_len ( n_nibbles ) ) ;
1835
1835
assert ! ( h. serialize( & mut res) . is_ok( ) ) ;
1836
1836
assert_eq ! ( res. len( ) , enc_len( n_nibbles) ) ;
1837
1837
let mut reader = & res[ ..] ;
You can’t perform that action at this time.
0 commit comments