Skip to content

Commit f90cf59

Browse files
Merge #309
309: add more traits to SPI error r=richardeoin a=andrewgazelka - Adds `Copy, Clone, PartialEq, Eq` Co-authored-by: Andrew Gazelka <andrew.gazelka@gmail.com>
2 parents 43da651 + 5523b59 commit f90cf59

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/rng.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ macro_rules! rng_core {
130130
let mut i = 0_usize;
131131
while i < buffer.len() {
132132
let random_word = self.value()?;
133+
134+
// using to_ne_bytes does not work for u8 and would make the macro
135+
// implementation more complicated
136+
#[allow(clippy::transmute_num_to_bytes)]
133137
let bytes: [$type; BATCH_SIZE] = unsafe { mem::transmute(random_word) };
134138
let n = cmp::min(BATCH_SIZE, buffer.len() - i);
135139
buffer[i..i + n].copy_from_slice(&bytes[..n]);

src/spi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ use crate::stm32::{SPI1, SPI2, SPI3, SPI4, SPI5, SPI6};
9898
use crate::time::Hertz;
9999

100100
/// SPI error
101-
#[derive(Debug)]
101+
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
102102
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
103103
#[non_exhaustive]
104104
pub enum Error {

0 commit comments

Comments
 (0)