File tree Expand file tree Collapse file tree 2 files changed +7
-12
lines changed Expand file tree Collapse file tree 2 files changed +7
-12
lines changed Original file line number Diff line number Diff line change @@ -902,7 +902,7 @@ fn u2i() {
902
902
"u_32" : 1234_i64 ,
903
903
"u_32_max" : u32 :: MAX as i64 ,
904
904
"u_64" : 12345_i64 ,
905
- "i_64_max" : i64 :: MAX as u64 ,
905
+ "i_64_max" : i64 :: MAX ,
906
906
} ;
907
907
908
908
run_test ( & v, & expected, "u2i - valid" ) ;
Original file line number Diff line number Diff line change @@ -172,8 +172,8 @@ impl ObjectId {
172
172
hex:: encode ( self . id )
173
173
}
174
174
175
- // Generates a new timestamp representing the current seconds since epoch.
176
- // Represented in Big Endian.
175
+ /// Generates a new timestamp representing the current seconds since epoch.
176
+ /// Represented in Big Endian.
177
177
fn gen_timestamp ( ) -> [ u8 ; 4 ] {
178
178
let timestamp: u32 = SystemTime :: now ( )
179
179
. duration_since ( SystemTime :: UNIX_EPOCH )
@@ -184,22 +184,17 @@ impl ObjectId {
184
184
timestamp. to_be_bytes ( )
185
185
}
186
186
187
- // Generate a random 5-byte array.
187
+ /// Generate a random 5-byte array.
188
188
fn gen_process_id ( ) -> [ u8 ; 5 ] {
189
189
lazy_static ! {
190
- static ref BUF : [ u8 ; 5 ] = {
191
- let rng = thread_rng( ) . gen_range( 0 , MAX_U24 ) as u32 ;
192
- let mut buf: [ u8 ; 5 ] = [ 0 ; 5 ] ;
193
- buf[ 0 ..4 ] . copy_from_slice( & rng. to_be_bytes( ) ) ;
194
- buf
195
- } ;
190
+ static ref BUF : [ u8 ; 5 ] = thread_rng( ) . gen ( ) ;
196
191
}
197
192
198
193
* BUF
199
194
}
200
195
201
- // Gets an incremental 3-byte count.
202
- // Represented in Big Endian.
196
+ /// Gets an incremental 3-byte count.
197
+ /// Represented in Big Endian.
203
198
fn gen_count ( ) -> [ u8 ; 3 ] {
204
199
let u_counter = OID_COUNTER . fetch_add ( 1 , Ordering :: SeqCst ) ;
205
200
You can’t perform that action at this time.
0 commit comments