@@ -150,14 +150,14 @@ impl<const N: usize, G: Generator<Output = [u32; N]>> BlockRng<G> {
150150 /// This will force a new set of results to be generated on next use.
151151 #[ inline]
152152 pub fn reset ( & mut self ) {
153- self . index = self . results . as_ref ( ) . len ( ) ;
153+ self . index = self . results . len ( ) ;
154154 }
155155
156156 /// Generate a new set of results immediately, setting the index to the
157157 /// given value.
158158 #[ inline]
159159 pub fn generate_and_set ( & mut self , index : usize ) {
160- assert ! ( index < self . results. as_ref ( ) . len( ) ) ;
160+ assert ! ( index < self . results. len( ) ) ;
161161 self . core . generate ( & mut self . results ) ;
162162 self . index = index;
163163 }
@@ -166,11 +166,11 @@ impl<const N: usize, G: Generator<Output = [u32; N]>> BlockRng<G> {
166166impl < const N : usize , G : Generator < Output = [ u32 ; N ] > > RngCore for BlockRng < G > {
167167 #[ inline]
168168 fn next_u32 ( & mut self ) -> u32 {
169- if self . index >= self . results . as_ref ( ) . len ( ) {
169+ if self . index >= self . results . len ( ) {
170170 self . generate_and_set ( 0 ) ;
171171 }
172172
173- let value = self . results . as_ref ( ) [ self . index ] ;
173+ let value = self . results [ self . index ] ;
174174 self . index += 1 ;
175175 value
176176 }
@@ -182,20 +182,20 @@ impl<const N: usize, G: Generator<Output = [u32; N]>> RngCore for BlockRng<G> {
182182 ( u64:: from ( data[ 1 ] ) << 32 ) | u64:: from ( data[ 0 ] )
183183 } ;
184184
185- let len = self . results . as_ref ( ) . len ( ) ;
185+ let len = self . results . len ( ) ;
186186
187187 let index = self . index ;
188188 if index < len - 1 {
189189 self . index += 2 ;
190190 // Read an u64 from the current index
191- read_u64 ( self . results . as_ref ( ) , index)
191+ read_u64 ( & self . results , index)
192192 } else if index >= len {
193193 self . generate_and_set ( 2 ) ;
194- read_u64 ( self . results . as_ref ( ) , 0 )
194+ read_u64 ( & self . results , 0 )
195195 } else {
196- let x = u64:: from ( self . results . as_ref ( ) [ len - 1 ] ) ;
196+ let x = u64:: from ( self . results [ len - 1 ] ) ;
197197 self . generate_and_set ( 1 ) ;
198- let y = u64:: from ( self . results . as_ref ( ) [ 0 ] ) ;
198+ let y = u64:: from ( self . results [ 0 ] ) ;
199199 ( y << 32 ) | x
200200 }
201201 }
@@ -204,11 +204,11 @@ impl<const N: usize, G: Generator<Output = [u32; N]>> RngCore for BlockRng<G> {
204204 fn fill_bytes ( & mut self , dest : & mut [ u8 ] ) {
205205 let mut read_len = 0 ;
206206 while read_len < dest. len ( ) {
207- if self . index >= self . results . as_ref ( ) . len ( ) {
207+ if self . index >= self . results . len ( ) {
208208 self . generate_and_set ( 0 ) ;
209209 }
210210 let ( consumed_u32, filled_u8) =
211- fill_via_chunks ( & self . results . as_mut ( ) [ self . index ..] , & mut dest[ read_len..] ) ;
211+ fill_via_chunks ( & self . results [ self . index ..] , & mut dest[ read_len..] ) ;
212212
213213 self . index += consumed_u32;
214214 read_len += filled_u8;
@@ -290,7 +290,7 @@ impl<const N: usize, G: Generator<Output = [u64; N]>> BlockRng64<G> {
290290 let results_empty = [ 0 ; N ] ;
291291 BlockRng64 {
292292 core,
293- index : results_empty. as_ref ( ) . len ( ) ,
293+ index : results_empty. len ( ) ,
294294 half_used : false ,
295295 results : results_empty,
296296 }
@@ -310,15 +310,15 @@ impl<const N: usize, G: Generator<Output = [u64; N]>> BlockRng64<G> {
310310 /// This will force a new set of results to be generated on next use.
311311 #[ inline]
312312 pub fn reset ( & mut self ) {
313- self . index = self . results . as_ref ( ) . len ( ) ;
313+ self . index = self . results . len ( ) ;
314314 self . half_used = false ;
315315 }
316316
317317 /// Generate a new set of results immediately, setting the index to the
318318 /// given value.
319319 #[ inline]
320320 pub fn generate_and_set ( & mut self , index : usize ) {
321- assert ! ( index < self . results. as_ref ( ) . len( ) ) ;
321+ assert ! ( index < self . results. len( ) ) ;
322322 self . core . generate ( & mut self . results ) ;
323323 self . index = index;
324324 self . half_used = false ;
@@ -329,7 +329,7 @@ impl<const N: usize, G: Generator<Output = [u64; N]>> RngCore for BlockRng64<G>
329329 #[ inline]
330330 fn next_u32 ( & mut self ) -> u32 {
331331 let mut index = self . index - self . half_used as usize ;
332- if index >= self . results . as_ref ( ) . len ( ) {
332+ if index >= self . results . len ( ) {
333333 self . core . generate ( & mut self . results ) ;
334334 self . index = 0 ;
335335 index = 0 ;
@@ -342,17 +342,17 @@ impl<const N: usize, G: Generator<Output = [u64; N]>> RngCore for BlockRng64<G>
342342 self . half_used = !self . half_used ;
343343 self . index += self . half_used as usize ;
344344
345- ( self . results . as_ref ( ) [ index] >> shift) as u32
345+ ( self . results [ index] >> shift) as u32
346346 }
347347
348348 #[ inline]
349349 fn next_u64 ( & mut self ) -> u64 {
350- if self . index >= self . results . as_ref ( ) . len ( ) {
350+ if self . index >= self . results . len ( ) {
351351 self . core . generate ( & mut self . results ) ;
352352 self . index = 0 ;
353353 }
354354
355- let value = self . results . as_ref ( ) [ self . index ] ;
355+ let value = self . results [ self . index ] ;
356356 self . index += 1 ;
357357 self . half_used = false ;
358358 value
@@ -363,13 +363,13 @@ impl<const N: usize, G: Generator<Output = [u64; N]>> RngCore for BlockRng64<G>
363363 let mut read_len = 0 ;
364364 self . half_used = false ;
365365 while read_len < dest. len ( ) {
366- if self . index >= self . results . as_ref ( ) . len ( ) {
366+ if self . index >= self . results . len ( ) {
367367 self . core . generate ( & mut self . results ) ;
368368 self . index = 0 ;
369369 }
370370
371371 let ( consumed_u64, filled_u8) =
372- fill_via_chunks ( & self . results . as_mut ( ) [ self . index ..] , & mut dest[ read_len..] ) ;
372+ fill_via_chunks ( & self . results [ self . index ..] , & mut dest[ read_len..] ) ;
373373
374374 self . index += consumed_u64;
375375 read_len += filled_u8;
@@ -513,23 +513,23 @@ mod test {
513513 #[ test]
514514 fn blockrng64_generate_and_set ( ) {
515515 let mut rng = BlockRng64 :: < DummyRng64 > :: from_seed ( [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ] ) ;
516- assert_eq ! ( rng. index( ) , rng. results. as_ref ( ) . len( ) ) ;
516+ assert_eq ! ( rng. index( ) , rng. results. len( ) ) ;
517517
518518 rng. generate_and_set ( 5 ) ;
519519 assert_eq ! ( rng. index( ) , 5 ) ;
520520 }
521521
522522 #[ test]
523- #[ should_panic( expected = "index < self.results.as_ref(). len()" ) ]
523+ #[ should_panic( expected = "index < self.results.len()" ) ]
524524 fn blockrng64_generate_and_set_panic ( ) {
525525 let mut rng = BlockRng64 :: < DummyRng64 > :: from_seed ( [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ] ) ;
526- rng. generate_and_set ( rng. results . as_ref ( ) . len ( ) ) ;
526+ rng. generate_and_set ( rng. results . len ( ) ) ;
527527 }
528528
529529 #[ test]
530530 fn blockrng_next_u64 ( ) {
531531 let mut rng = BlockRng :: < DummyRng > :: from_seed ( [ 1 , 2 , 3 , 4 ] ) ;
532- let result_size = rng. results . as_ref ( ) . len ( ) ;
532+ let result_size = rng. results . len ( ) ;
533533 for _i in 0 ..result_size / 2 - 1 {
534534 rng. next_u64 ( ) ;
535535 }
0 commit comments