@@ -291,9 +291,9 @@ impl<T, S: HistBufStorage<T> + ?Sized> HistoryBufferInner<T, S> {
291291 unsafe fn drop_contents ( & mut self ) {
292292 unsafe {
293293 ptr:: drop_in_place ( ptr:: slice_from_raw_parts_mut (
294- self . data . borrow_mut ( ) . as_mut_ptr ( ) as * mut T ,
294+ self . data . borrow_mut ( ) . as_mut_ptr ( ) . cast :: < T > ( ) ,
295295 self . len ( ) ,
296- ) )
296+ ) ) ;
297297 }
298298 }
299299
@@ -446,7 +446,7 @@ impl<T, S: HistBufStorage<T> + ?Sized> HistoryBufferInner<T, S> {
446446 /// Returns the array slice backing the buffer, without keeping track
447447 /// of the write position. Therefore, the element order is unspecified.
448448 pub fn as_slice ( & self ) -> & [ T ] {
449- unsafe { slice:: from_raw_parts ( self . data . borrow ( ) . as_ptr ( ) as * const _ , self . len ( ) ) }
449+ unsafe { slice:: from_raw_parts ( self . data . borrow ( ) . as_ptr ( ) . cast ( ) , self . len ( ) ) }
450450 }
451451
452452 /// Returns a pair of slices which contain, in order, the contents of the buffer.
@@ -464,10 +464,10 @@ impl<T, S: HistBufStorage<T> + ?Sized> HistoryBufferInner<T, S> {
464464 pub fn as_slices ( & self ) -> ( & [ T ] , & [ T ] ) {
465465 let buffer = self . as_slice ( ) ;
466466
467- if !self . filled {
468- ( buffer, & [ ] )
469- } else {
467+ if self . filled {
470468 ( & buffer[ self . write_at ..] , & buffer[ ..self . write_at ] )
469+ } else {
470+ ( buffer, & [ ] )
471471 }
472472 }
473473
@@ -514,7 +514,7 @@ where
514514 where
515515 I : IntoIterator < Item = & ' a T > ,
516516 {
517- self . extend ( iter. into_iter ( ) . cloned ( ) )
517+ self . extend ( iter. into_iter ( ) . cloned ( ) ) ;
518518 }
519519}
520520
@@ -791,7 +791,7 @@ mod tests {
791791 assert_eq ! ( x. as_slice( ) , [ 5 , 2 , 3 , 4 ] ) ;
792792 }
793793
794- /// Test whether .as_slices() behaves as expected.
794+ /// Test whether ` .as_slices()` behaves as expected.
795795 #[ test]
796796 fn as_slices ( ) {
797797 let mut buffer: HistoryBuffer < u8 , 4 > = HistoryBuffer :: new ( ) ;
@@ -807,7 +807,7 @@ mod tests {
807807 extend_then_assert ( b"123456" , ( b"34" , b"56" ) ) ;
808808 }
809809
810- /// Test whether .as_slices() and .oldest_ordered() produce elements in the same order.
810+ /// Test whether ` .as_slices()` and ` .oldest_ordered()` produce elements in the same order.
811811 #[ test]
812812 fn as_slices_equals_ordered ( ) {
813813 let mut buffer: HistoryBuffer < u8 , 6 > = HistoryBuffer :: new ( ) ;
@@ -818,7 +818,7 @@ mod tests {
818818 assert_eq_iter (
819819 [ head, tail] . iter ( ) . copied ( ) . flatten ( ) ,
820820 buffer. oldest_ordered ( ) ,
821- )
821+ ) ;
822822 }
823823 }
824824
0 commit comments