Skip to content

Commit

Permalink
dma: address clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mciantyre committed Aug 22, 2020
1 parent 52e4bbd commit c55241b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions imxrt-hal/src/dma/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,9 @@ impl<E: Element> Circular<E> {
Err(CircularError::BufferTaken)
} else {
// Safety: it's not taken
unsafe { Self::new_unchecked(buffer) }.or_else(|err| {
unsafe { Self::new_unchecked(buffer) }.map_err(|err| {
buffer.taken.store(false, Ordering::SeqCst);
Err(err)
err
})
}
}
Expand Down Expand Up @@ -543,9 +543,9 @@ impl<E: Element> Circular<E> {

/// Remove the next element from the queue
pub fn pop(&mut self) -> Option<E> {
self.peek().and_then(|elem| {
self.peek().map(|elem| {
self.mark_read(1);
Some(elem)
elem
})
}

Expand Down
8 changes: 4 additions & 4 deletions imxrt-hal/src/dma/peripheral.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,9 @@ where
pub fn receive_complete(&mut self) -> Option<D> {
self.rx_channel.as_mut().unwrap().clear_complete();
self.peripheral.disable_source();
self.destination_buffer.take().and_then(|mut buffer| {
self.destination_buffer.take().map(|mut buffer| {
buffer.complete_destination();
Some(buffer)
buffer
})
}

Expand Down Expand Up @@ -441,9 +441,9 @@ where
pub fn transfer_complete(&mut self) -> Option<S> {
self.tx_channel.as_mut().unwrap().clear_complete();
self.peripheral.disable_destination();
self.source_buffer.take().and_then(|mut buffer| {
self.source_buffer.take().map(|mut buffer| {
buffer.complete_source();
Some(buffer)
buffer
})
}

Expand Down

0 comments on commit c55241b

Please sign in to comment.