fix a few clippy lints on files that are touched

This commit is contained in:
Robert Jördens 2021-06-01 17:32:06 +02:00
parent d97ee3f0c4
commit 18b6e99b10
3 changed files with 6 additions and 4 deletions

View File

@ -81,6 +81,7 @@ use hal::dma::{
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
pub struct AdcCode(pub u16); pub struct AdcCode(pub u16);
#[allow(clippy::from_over_into)]
impl Into<f32> for AdcCode { impl Into<f32> for AdcCode {
/// Convert raw ADC codes to/from voltage levels. /// Convert raw ADC codes to/from voltage levels.
/// ///

View File

@ -73,6 +73,7 @@ static mut DAC_BUF: [[SampleBuffer; 2]; 2] = [[[0; SAMPLE_BUFFER_SIZE]; 2]; 2];
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
pub struct DacCode(pub u16); pub struct DacCode(pub u16);
#[allow(clippy::from_over_into)]
impl Into<f32> for DacCode { impl Into<f32> for DacCode {
fn into(self) -> f32 { fn into(self) -> f32 {
// The DAC output range in bipolar mode (including the external output op-amp) is +/- 4.096 // The DAC output range in bipolar mode (including the external output op-amp) is +/- 4.096
@ -104,7 +105,7 @@ macro_rules! dac_output {
_channel: timers::tim2::$trigger_channel, _channel: timers::tim2::$trigger_channel,
spi: hal::spi::Spi<hal::stm32::$spi, hal::spi::Disabled, u16>, spi: hal::spi::Spi<hal::stm32::$spi, hal::spi::Disabled, u16>,
) -> Self { ) -> Self {
Self { _channel, spi } Self { spi, _channel }
} }
/// Start the SPI and begin operating in a DMA-driven transfer mode. /// Start the SPI and begin operating in a DMA-driven transfer mode.

View File

@ -103,7 +103,7 @@ where
let path = match topic.strip_prefix(prefix) { let path = match topic.strip_prefix(prefix) {
// For paths, we do not want to include the leading slash. // For paths, we do not want to include the leading slash.
Some(path) => { Some(path) => {
if path.len() > 0 { if !path.is_empty() {
&path[1..] &path[1..]
} else { } else {
path path
@ -117,9 +117,9 @@ where
let message: SettingsResponse = settings let message: SettingsResponse = settings
.string_set(path.split('/').peekable(), message) .string_set(path.split('/').peekable(), message)
.and_then(|_| { .map(|_| {
update = true; update = true;
Ok(()) ()
}) })
.into(); .into();