style: implement a couple clippy suggestions [nfc]

This commit is contained in:
Robert Jördens 2020-06-17 14:57:09 +02:00
parent f70612f1be
commit f14f0e2ed1
5 changed files with 18 additions and 27 deletions

View File

@ -120,9 +120,9 @@ where
RST: OutputPin,
{
let mut ad9959 = Ad9959 {
interface: interface,
io_update: io_update,
delay: delay,
interface,
io_update,
delay,
reference_clock_frequency: clock_frequency,
system_clock_multiplier: 1,
};

View File

@ -1,4 +1,3 @@
use embedded_hal;
use serde::{Deserialize, Serialize};
use core::convert::TryFrom;
@ -45,7 +44,7 @@ where
/// * `a0` - An output connected to the A0 input of the amplifier.
/// * `a1` - An output connected to the A1 input of the amplifier.
pub fn new(a0: A0, a1: A1) -> Self {
let mut afe = Self { a0: a0, a1: a1 };
let mut afe = Self { a0, a1 };
afe.set_gain(Gain::G1);

View File

@ -28,8 +28,6 @@ extern crate panic_halt;
extern crate log;
// use core::sync::atomic::{AtomicU32, AtomicBool, Ordering};
use asm_delay;
use cortex_m;
use cortex_m_rt::exception;
use rtic::cyccnt::{Instant, U32Ext};
use stm32h7xx_hal as hal;
@ -331,13 +329,12 @@ const APP: () = {
.frame_size(16)
.swap_mosi_miso();
let spi = dp.SPI4.spi(
dp.SPI4.spi(
(spi_sck, spi_miso, hal::spi::NoMosi),
config,
50.mhz(),
&clocks,
);
spi
)
};
let dac2_spi = {
@ -361,14 +358,12 @@ const APP: () = {
.frame_size(16)
.swap_mosi_miso();
let spi = dp.SPI5.spi(
dp.SPI5.spi(
(spi_sck, spi_miso, hal::spi::NoMosi),
config,
50.mhz(),
&clocks,
);
spi
)
};
let mut fp_led_0 = gpiod.pd5.into_push_pull_output();
@ -635,16 +630,16 @@ const APP: () = {
dac1: dac1_spi,
adc2: adc2_spi,
dac2: dac2_spi,
afe1: afe1,
afe2: afe2,
afe1,
afe2,
timer: timer2,
pounder: pounder_devices,
eeprom_i2c: eeprom_i2c,
eeprom_i2c,
net_interface: network_interface,
eth_mac: eth_mac,
mac_addr: mac_addr,
eth_mac,
mac_addr,
}
}

View File

@ -1,6 +1,3 @@
use ad9959;
use mcp23017;
use serde::{Deserialize, Serialize};
mod attenuators;
@ -106,7 +103,7 @@ impl QspiInterface {
qspi.configure_mode(hal::qspi::QspiMode::FourBit)
.map_err(|_| Error::Qspi)?;
Ok(Self {
qspi: qspi,
qspi,
mode: ad9959::Mode::SingleBitTwoWire,
})
}
@ -396,8 +393,8 @@ where
let power = self.measure_power(channel)?;
Ok(InputChannelState {
attenuation: attenuation,
power: power,
attenuation,
power,
mixer: channel_state,
})
}
@ -458,7 +455,7 @@ where
let attenuation = self.get_attenuation(channel)?;
Ok(OutputChannelState {
attenuation: attenuation,
attenuation,
channel: channel_state,
})
}

View File

@ -125,7 +125,7 @@ impl Response {
/// * `message` - The message denoting the status.
pub fn custom<'a>(code: i32, message: &'a str) -> Self {
let mut res = Self {
code: code,
code,
attribute: String::from(""),
value: String::from(message),
};