@@ -31,7 +31,7 @@ pub fn tsk_column_access<
3131 tsk_column_access_detail ( row, column, column_length) . map ( |v| v. into ( ) )
3232}
3333
34- pub fn tsk_ragged_column_access_detail <
34+ fn tsk_ragged_column_access_detail <
3535 R : Into < bindings:: tsk_id_t > ,
3636 L : Into < bindings:: tsk_size_t > ,
3737 T : Copy ,
@@ -48,7 +48,9 @@ pub fn tsk_ragged_column_access_detail<
4848 None
4949 } else {
5050 assert ! ( !column. is_null( ) ) ;
51- assert ! ( !column. is_null( ) ) ;
51+ assert ! ( !offset. is_null( ) ) ;
52+ // SAFETY: pointers are not null
53+ // and *_length are given by tskit-c
5254 let index = row as isize ;
5355 let start = unsafe { * offset. offset ( index) } ;
5456 let stop = if ( row as bindings:: tsk_size_t ) < column_length {
@@ -80,8 +82,7 @@ pub fn tsk_ragged_column_access<
8082 offset : * const bindings:: tsk_size_t ,
8183 offset_length : bindings:: tsk_size_t ,
8284) -> Option < & ' a [ O ] > {
83- match tsk_ragged_column_access_detail ( row, column, column_length, offset, offset_length) {
84- Some ( ( p, n) ) => Some ( unsafe { std:: slice:: from_raw_parts ( p. cast :: < O > ( ) , n) } ) ,
85- None => None ,
86- }
85+ // SAFETY: see tsk_ragged_column_access_detail
86+ tsk_ragged_column_access_detail ( row, column, column_length, offset, offset_length)
87+ . map ( |( p, n) | unsafe { std:: slice:: from_raw_parts ( p. cast :: < O > ( ) , n) } )
8788}
0 commit comments