@@ -306,13 +306,11 @@ impl<T, S: Semaphore> Rx<T, S> {
306306 return Ready ( Some ( value) ) ;
307307 }
308308 Some ( Read :: Closed ) => {
309- // TODO: This check may not be required as it most
310- // likely can only return `true` at this point. A
311- // channel is closed when all tx handles are
309+ // A channel is closed when all tx handles are
312310 // dropped. Dropping a tx handle releases memory,
313311 // which ensures that if dropping the tx handle is
314312 // visible, then all messages sent are also visible.
315- assert !( self . inner. semaphore. is_idle( ) ) ;
313+ debug_assert !( self . inner. semaphore. is_idle( ) ) ;
316314 coop. made_progress( ) ;
317315 return Ready ( None ) ;
318316 }
@@ -380,13 +378,11 @@ impl<T, S: Semaphore> Rx<T, S> {
380378 if number_added > 0 {
381379 self . inner. semaphore. add_permits( number_added) ;
382380 }
383- // TODO: This check may not be required as it most
384- // likely can only return `true` at this point. A
385- // channel is closed when all tx handles are
381+ // A channel is closed when all tx handles are
386382 // dropped. Dropping a tx handle releases memory,
387383 // which ensures that if dropping the tx handle is
388384 // visible, then all messages sent are also visible.
389- assert !( self . inner. semaphore. is_idle( ) ) ;
385+ debug_assert !( self . inner. semaphore. is_idle( ) ) ;
390386 coop. made_progress( ) ;
391387 return Ready ( number_added) ;
392388 }
@@ -415,7 +411,7 @@ impl<T, S: Semaphore> Rx<T, S> {
415411 try_recv ! ( ) ;
416412
417413 if rx_fields. rx_closed && self . inner . semaphore . is_idle ( ) {
418- assert ! ( buffer. is_empty ( ) ) ;
414+ debug_assert_eq ! ( buffer. len ( ) , initial_length ) ;
419415 coop. made_progress ( ) ;
420416 Ready ( 0usize )
421417 } else {
0 commit comments