From 18b6e99b10c730a861c1c52a6399fe12efa3655f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20J=C3=B6rdens?= Date: Tue, 1 Jun 2021 17:32:06 +0200 Subject: [PATCH] fix a few clippy lints on files that are touched --- src/hardware/adc.rs | 1 + src/hardware/dac.rs | 3 ++- src/net/miniconf_client.rs | 6 +++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/hardware/adc.rs b/src/hardware/adc.rs index 8919479..26752f7 100644 --- a/src/hardware/adc.rs +++ b/src/hardware/adc.rs @@ -81,6 +81,7 @@ use hal::dma::{ #[derive(Copy, Clone)] pub struct AdcCode(pub u16); +#[allow(clippy::from_over_into)] impl Into for AdcCode { /// Convert raw ADC codes to/from voltage levels. /// diff --git a/src/hardware/dac.rs b/src/hardware/dac.rs index 013c43a..9b42e37 100644 --- a/src/hardware/dac.rs +++ b/src/hardware/dac.rs @@ -73,6 +73,7 @@ static mut DAC_BUF: [[SampleBuffer; 2]; 2] = [[[0; SAMPLE_BUFFER_SIZE]; 2]; 2]; #[derive(Copy, Clone)] pub struct DacCode(pub u16); +#[allow(clippy::from_over_into)] impl Into for DacCode { fn into(self) -> f32 { // 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, spi: hal::spi::Spi, ) -> Self { - Self { _channel, spi } + Self { spi, _channel } } /// Start the SPI and begin operating in a DMA-driven transfer mode. diff --git a/src/net/miniconf_client.rs b/src/net/miniconf_client.rs index e5f328a..f280318 100644 --- a/src/net/miniconf_client.rs +++ b/src/net/miniconf_client.rs @@ -103,7 +103,7 @@ where let path = match topic.strip_prefix(prefix) { // For paths, we do not want to include the leading slash. Some(path) => { - if path.len() > 0 { + if !path.is_empty() { &path[1..] } else { path @@ -117,9 +117,9 @@ where let message: SettingsResponse = settings .string_set(path.split('/').peekable(), message) - .and_then(|_| { + .map(|_| { update = true; - Ok(()) + () }) .into();