@@ -420,6 +420,7 @@ where
420
420
421
421
/// A DMA transfer
422
422
pub struct Transfer < T : Instance , B > {
423
+ // FIXME: Always `Some`, only using `Option` here to allow moving fields out of `inner`.
423
424
inner : Option < Inner < T , B > > ,
424
425
}
425
426
@@ -463,6 +464,7 @@ impl<T: Instance, B> Drop for Transfer<T, B> {
463
464
}
464
465
/// A full duplex DMA transfer
465
466
pub struct TransferSplit < T : Instance , TxB , RxB > {
467
+ // FIXME: Always `Some`, only using `Option` here to allow moving fields out of `inner`.
466
468
inner : Option < InnerSplit < T , TxB , RxB > > ,
467
469
}
468
470
@@ -490,15 +492,15 @@ impl<T: Instance, TxB, RxB> TransferSplit<T, TxB, RxB> {
490
492
pub fn is_done ( & mut self ) -> bool {
491
493
let inner = self
492
494
. inner
493
- . take ( )
495
+ . as_mut ( )
494
496
. unwrap_or_else ( || unsafe { core:: hint:: unreachable_unchecked ( ) } ) ;
495
497
inner. spis . is_done ( )
496
498
}
497
499
}
498
500
499
501
impl < T : Instance , TxB , RxB > Drop for TransferSplit < T , TxB , RxB > {
500
502
fn drop ( & mut self ) {
501
- if let Some ( inner) = self . inner . as_mut ( ) {
503
+ if let Some ( inner) = self . inner . take ( ) {
502
504
compiler_fence ( Ordering :: SeqCst ) ;
503
505
while !inner. spis . is_done ( ) { }
504
506
inner. spis . disable ( ) ;
0 commit comments