Skip to content

Commit c8c2de5

Browse files
committed
Simplify code
1 parent 588150c commit c8c2de5

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/lib.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,7 @@ pub struct SpidevOptions {
140140
impl SpidevOptions {
141141
/// Create a new, empty set of options
142142
pub fn new() -> SpidevOptions {
143-
SpidevOptions {
144-
bits_per_word: None,
145-
max_speed_hz: None,
146-
lsb_first: None,
147-
spi_mode: None,
148-
}
143+
SpidevOptions::default()
149144
}
150145

151146
/// The number of bits in each SPI transfer word
@@ -194,7 +189,7 @@ impl SpidevOptions {
194189

195190
/// Finalize and build the SpidevOptions
196191
pub fn build(&self) -> Self {
197-
self.clone()
192+
*self
198193
}
199194
}
200195

0 commit comments

Comments
 (0)