Skip to content

Commit

Permalink
Fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
dbrgn committed Jan 6, 2023
1 parent d48d1e1 commit 2ac8a79
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/adc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ use crate::error::MockError;
/// ADC transaction type
///
/// Models an ADC read
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Transaction<T> {
expected_chan: u8,
response: T,
Expand Down Expand Up @@ -94,7 +94,7 @@ macro_rules! mock_channel {
($ADC:ident, $($pin:ident => $chan:expr),+ $(,)*) => {
$(
/// Mock ADC channel implementation
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct $pin;

impl Channel<$ADC> for $pin {
Expand Down
2 changes: 1 addition & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::{error::Error as StdError, fmt, io};

/// Errors that may occur during mocking.
#[derive(PartialEq, Clone, Debug)]
#[derive(PartialEq, Eq, Clone, Debug)]
pub enum MockError {
/// An I/O-Error occurred
Io(io::ErrorKind),
Expand Down
4 changes: 2 additions & 2 deletions src/i2c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ use crate::common::Generic;
use crate::error::MockError;

/// I2C Transaction modes
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum Mode {
/// Write transaction
Write,
Expand All @@ -90,7 +90,7 @@ pub enum Mode {
/// I2C Transaction type
///
/// Models an I2C read or write
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Transaction {
expected_mode: Mode,
expected_addr: u8,
Expand Down
10 changes: 5 additions & 5 deletions src/pin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ use embedded_hal::PwmPin;
pub type PwmDuty = u16;

/// MockPin transaction
#[derive(PartialEq, Clone, Debug)]
#[derive(PartialEq, Eq, Clone, Debug)]
pub struct Transaction {
/// Kind is the transaction kind (and data) expected
kind: TransactionKind,
Expand All @@ -59,7 +59,7 @@ pub struct Transaction {
err: Option<MockError>,
}

#[derive(PartialEq, Clone, Debug)]
#[derive(PartialEq, Eq, Copy, Clone, Debug)]
/// Digital pin value enumeration
pub enum State {
/// Digital low state
Expand Down Expand Up @@ -126,7 +126,7 @@ impl Transaction {
}

/// MockPin transaction kind.
#[derive(PartialEq, Clone, Debug)]
#[derive(PartialEq, Eq, Clone, Debug)]
pub enum TransactionKind {
/// Set the pin state
Set(State),
Expand Down Expand Up @@ -212,7 +212,7 @@ impl InputPin for Mock {

let Transaction { kind, err } = s.next().expect("no expectation for pin::is_high call");

assert_eq!(kind.is_get(), true, "expected pin::get");
assert!(kind.is_get(), "expected pin::get");

if let Some(e) = err {
Err(e)
Expand All @@ -229,7 +229,7 @@ impl InputPin for Mock {

let Transaction { kind, err } = s.next().expect("no expectation for pin::is_low call");

assert_eq!(kind.is_get(), true, "expected pin::get");
assert!(kind.is_get(), "expected pin::get");

if let Some(e) = err {
Err(e)
Expand Down
4 changes: 2 additions & 2 deletions src/spi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ use crate::common::Generic;
use crate::error::MockError;

/// SPI Transaction mode
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum Mode {
/// Write transaction
Write,
Expand All @@ -65,7 +65,7 @@ pub enum Mode {
/// SPI transaction type
///
/// Models an SPI write or transfer (with response)
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Transaction {
expected_mode: Mode,
expected_data: Vec<u8>,
Expand Down

0 comments on commit 2ac8a79

Please sign in to comment.