aboutsummaryrefslogtreecommitdiff
path: root/embassy-nrf/src/uarte.rs
diff options
context:
space:
mode:
authorPriit Laes <[email protected]>2024-02-17 12:52:20 +0200
committerPriit Laes <[email protected]>2024-02-17 13:30:19 +0200
commit1aa999c2a825bdaf6fa4c980f47428d9b1d9263f (patch)
tree83941a63bf3b5e444f0efe50bb3888f5c0e2fff1 /embassy-nrf/src/uarte.rs
parent377e58e408f830f79171a470ba602b7d8bc525e4 (diff)
nrf: Use .is_empty() instead of .len() == 0
Diffstat (limited to 'embassy-nrf/src/uarte.rs')
-rw-r--r--embassy-nrf/src/uarte.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/embassy-nrf/src/uarte.rs b/embassy-nrf/src/uarte.rs
index de2966ba5..3d486452f 100644
--- a/embassy-nrf/src/uarte.rs
+++ b/embassy-nrf/src/uarte.rs
@@ -386,7 +386,7 @@ impl<'d, T: Instance> UarteTx<'d, T> {
386 386
387 /// Same as [`write`](Self::write) but will fail instead of copying data into RAM. Consult the module level documentation to learn more. 387 /// Same as [`write`](Self::write) but will fail instead of copying data into RAM. Consult the module level documentation to learn more.
388 pub async fn write_from_ram(&mut self, buffer: &[u8]) -> Result<(), Error> { 388 pub async fn write_from_ram(&mut self, buffer: &[u8]) -> Result<(), Error> {
389 if buffer.len() == 0 { 389 if buffer.is_empty() {
390 return Ok(()); 390 return Ok(());
391 } 391 }
392 392
@@ -456,7 +456,7 @@ impl<'d, T: Instance> UarteTx<'d, T> {
456 456
457 /// Same as [`write_from_ram`](Self::write_from_ram) but will fail instead of copying data into RAM. Consult the module level documentation to learn more. 457 /// Same as [`write_from_ram`](Self::write_from_ram) but will fail instead of copying data into RAM. Consult the module level documentation to learn more.
458 pub fn blocking_write_from_ram(&mut self, buffer: &[u8]) -> Result<(), Error> { 458 pub fn blocking_write_from_ram(&mut self, buffer: &[u8]) -> Result<(), Error> {
459 if buffer.len() == 0 { 459 if buffer.is_empty() {
460 return Ok(()); 460 return Ok(());
461 } 461 }
462 462
@@ -694,7 +694,7 @@ impl<'d, T: Instance> UarteRx<'d, T> {
694 694
695 /// Read bytes until the buffer is filled. 695 /// Read bytes until the buffer is filled.
696 pub fn blocking_read(&mut self, buffer: &mut [u8]) -> Result<(), Error> { 696 pub fn blocking_read(&mut self, buffer: &mut [u8]) -> Result<(), Error> {
697 if buffer.len() == 0 { 697 if buffer.is_empty() {
698 return Ok(()); 698 return Ok(());
699 } 699 }
700 if buffer.len() > EASY_DMA_SIZE { 700 if buffer.len() > EASY_DMA_SIZE {
@@ -775,7 +775,7 @@ impl<'d, T: Instance, U: TimerInstance> UarteRxWithIdle<'d, T, U> {
775 /// 775 ///
776 /// Returns the amount of bytes read. 776 /// Returns the amount of bytes read.
777 pub async fn read_until_idle(&mut self, buffer: &mut [u8]) -> Result<usize, Error> { 777 pub async fn read_until_idle(&mut self, buffer: &mut [u8]) -> Result<usize, Error> {
778 if buffer.len() == 0 { 778 if buffer.is_empty() {
779 return Ok(0); 779 return Ok(0);
780 } 780 }
781 if buffer.len() > EASY_DMA_SIZE { 781 if buffer.len() > EASY_DMA_SIZE {
@@ -848,7 +848,7 @@ impl<'d, T: Instance, U: TimerInstance> UarteRxWithIdle<'d, T, U> {
848 /// 848 ///
849 /// Returns the amount of bytes read. 849 /// Returns the amount of bytes read.
850 pub fn blocking_read_until_idle(&mut self, buffer: &mut [u8]) -> Result<usize, Error> { 850 pub fn blocking_read_until_idle(&mut self, buffer: &mut [u8]) -> Result<usize, Error> {
851 if buffer.len() == 0 { 851 if buffer.is_empty() {
852 return Ok(0); 852 return Ok(0);
853 } 853 }
854 if buffer.len() > EASY_DMA_SIZE { 854 if buffer.len() > EASY_DMA_SIZE {