Skip to content

Commit 83e70bd

Browse files
committed
Address a few clippy lints
Signed-off-by: Daniel Egger <[email protected]>
1 parent 2e44a4e commit 83e70bd

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1414
- Poll for SPI transaction completion before returning
1515
- Update `remap_pins()` and remove critical section
1616
- Updated `stm32f0` peripheral access crate from 0.13 to 0.14
17+
- Address a few clippy lints
1718

1819
### Added
1920

src/adc.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ impl VTemp {
289289
/// Otherwise it will approximate the required delay using ADC reads.
290290
pub fn read(adc: &mut Adc, delay: Option<&mut Delay>) -> i16 {
291291
let mut vtemp = Self::new();
292-
let vtemp_preenable = vtemp.is_enabled(&adc);
292+
let vtemp_preenable = vtemp.is_enabled(adc);
293293

294294
if !vtemp_preenable {
295295
vtemp.enable(adc);
@@ -345,7 +345,7 @@ impl VRef {
345345

346346
let prev_cfg = adc.default_cfg();
347347

348-
let vref_val: u32 = if vref.is_enabled(&adc) {
348+
let vref_val: u32 = if vref.is_enabled(adc) {
349349
adc.read(&mut vref).unwrap()
350350
} else {
351351
vref.enable(adc);
@@ -435,7 +435,7 @@ impl VBat {
435435
pub fn read(adc: &mut Adc) -> u16 {
436436
let mut vbat = Self::new();
437437

438-
let vbat_val: u16 = if vbat.is_enabled(&adc) {
438+
let vbat_val: u16 = if vbat.is_enabled(adc) {
439439
adc.read_abs_mv(&mut vbat)
440440
} else {
441441
vbat.enable(adc);

src/i2c.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ impl<I2C, SCLPIN, SDAPIN> I2c<I2C, SCLPIN, SDAPIN>
203203
where
204204
I2C: Deref<Target = I2cRegisterBlock>,
205205
{
206-
fn i2c_init(self: Self, speed: KiloHertz) -> Self {
206+
fn i2c_init(self, speed: KiloHertz) -> Self {
207207
use core::cmp;
208208

209209
// Make sure the I2C unit is disabled so we can configure it

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#![no_std]
22
#![allow(non_camel_case_types)]
3+
#![allow(clippy::uninit_assumed_init)]
34

45
pub use stm32f0;
56

src/serial.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ use crate::{gpio::*, rcc::Rcc, time::Bps};
7171
use core::marker::PhantomData;
7272

7373
/// Serial error
74+
#[non_exhaustive]
7475
#[derive(Debug)]
7576
pub enum Error {
7677
/// Framing error
@@ -81,8 +82,6 @@ pub enum Error {
8182
Overrun,
8283
/// Parity check error
8384
Parity,
84-
#[doc(hidden)]
85-
_Extensible,
8685
}
8786

8887
/// Interrupt event

src/spi.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ pub struct EightBit;
7474
pub struct SixteenBit;
7575

7676
/// SPI error
77+
#[non_exhaustive]
7778
#[derive(Debug)]
7879
pub enum Error {
7980
/// Overrun occurred
@@ -82,8 +83,6 @@ pub enum Error {
8283
ModeFault,
8384
/// CRC error
8485
Crc,
85-
#[doc(hidden)]
86-
_Extensible,
8786
}
8887

8988
/// SPI abstraction
@@ -445,7 +444,7 @@ where
445444

446445
for word in words.iter_mut() {
447446
nb::block!(self.check_send())?;
448-
self.send_u8(word.clone());
447+
self.send_u8(*word);
449448
nb::block!(self.check_read())?;
450449
*word = self.read_u8();
451450
}
@@ -522,7 +521,7 @@ where
522521

523522
for word in words {
524523
nb::block!(self.check_send())?;
525-
self.send_u16(word.clone());
524+
self.send_u16(*word);
526525
}
527526

528527
// Do one last status register check before continuing

0 commit comments

Comments
 (0)