@@ -22,7 +22,7 @@ use core::raw::Slice as RawSlice;
2222use core:: ptr;
2323use core:: kinds:: marker;
2424use core:: mem;
25- use core:: num;
25+ use core:: num:: { Int , UnsignedInt } ;
2626
2727use std:: hash:: { Writer , Hash } ;
2828use std:: cmp;
@@ -115,8 +115,8 @@ impl<T> RingBuf<T> {
115115 #[ unstable = "matches collection reform specification, waiting for dust to settle" ]
116116 pub fn with_capacity ( n : uint ) -> RingBuf < T > {
117117 // +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 > ( ) )
120120 . expect ( "capacity overflow" ) ;
121121
122122 let ptr = if mem:: size_of :: < T > ( ) != 0 {
@@ -280,12 +280,12 @@ impl<T> RingBuf<T> {
280280 let new_len = self . len ( ) + additional;
281281 assert ! ( new_len + 1 > self . len( ) , "capacity overflow" ) ;
282282 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 ( ) ;
284284 assert ! ( count >= new_len + 1 ) ;
285285
286286 if mem:: size_of :: < T > ( ) != 0 {
287287 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 > ( ) )
289289 . expect ( "capacity overflow" ) ;
290290 unsafe {
291291 self . ptr = heap:: reallocate ( self . ptr as * mut u8 ,
0 commit comments