@@ -22,7 +22,7 @@ use core::raw::Slice as RawSlice;
22
22
use core:: ptr;
23
23
use core:: kinds:: marker;
24
24
use core:: mem;
25
- use core:: num;
25
+ use core:: num:: { Int , UnsignedInt } ;
26
26
27
27
use std:: hash:: { Writer , Hash } ;
28
28
use std:: cmp;
@@ -115,8 +115,8 @@ impl<T> RingBuf<T> {
115
115
#[ unstable = "matches collection reform specification, waiting for dust to settle" ]
116
116
pub fn with_capacity ( n : uint ) -> RingBuf < T > {
117
117
// +1 since the ringbuffer always leaves one space empty
118
- let cap = num :: next_power_of_two ( cmp:: max ( n + 1 , MINIMUM_CAPACITY ) ) ;
119
- let size = cap. checked_mul ( & mem:: size_of :: < T > ( ) )
118
+ let cap = cmp:: max ( n + 1 , MINIMUM_CAPACITY ) . next_power_of_two ( ) ;
119
+ let size = cap. checked_mul ( mem:: size_of :: < T > ( ) )
120
120
. expect ( "capacity overflow" ) ;
121
121
122
122
let ptr = if mem:: size_of :: < T > ( ) != 0 {
@@ -280,12 +280,12 @@ impl<T> RingBuf<T> {
280
280
let new_len = self . len ( ) + additional;
281
281
assert ! ( new_len + 1 > self . len( ) , "capacity overflow" ) ;
282
282
if new_len > self . capacity ( ) {
283
- let count = num :: next_power_of_two ( new_len + 1 ) ;
283
+ let count = ( new_len + 1 ) . next_power_of_two ( ) ;
284
284
assert ! ( count >= new_len + 1 ) ;
285
285
286
286
if mem:: size_of :: < T > ( ) != 0 {
287
287
let old = self . cap * mem:: size_of :: < T > ( ) ;
288
- let new = count. checked_mul ( & mem:: size_of :: < T > ( ) )
288
+ let new = count. checked_mul ( mem:: size_of :: < T > ( ) )
289
289
. expect ( "capacity overflow" ) ;
290
290
unsafe {
291
291
self . ptr = heap:: reallocate ( self . ptr as * mut u8 ,
0 commit comments