Skip to content

Commit 0ac9098

Browse files
authored
clippy (#191)
* clippy
1 parent b08673e commit 0ac9098

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

src/adc.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ impl Temperature {
8383
/// ## Arguments
8484
/// * `sample`: ADC sample taken on the [`Temperature`] channel.
8585
/// * `vdda`: Analog reference voltage (vref+) when the temperature
86-
/// sample was taken, in volts.
86+
/// sample was taken, in volts.
8787
/// * `resolution`: Configured ADC resolution.
8888
#[inline(always)]
8989
pub fn temperature_to_degrees_centigrade(
@@ -108,7 +108,7 @@ impl Temperature {
108108
/// ## Arguments
109109
/// * `sample`: ADC sample taken on the [`Temperature`] channel.
110110
/// * `vdda`: Analog reference voltage (vref+) when the temperature
111-
/// sample was taken, in millivolts.
111+
/// sample was taken, in millivolts.
112112
/// * `resolution`: Configured ADC resolution.
113113
#[inline(always)]
114114
pub fn temperature_to_degrees_centigrade_coarse(
@@ -1895,7 +1895,7 @@ macro_rules! adc {
18951895
/// * `channel` - channel to configure
18961896
/// * `sequence` - where in the sequence to sample the channel. Also called rank in some STM docs/code
18971897
/// * `sample_time` - how long to sample for. See datasheet and ref manual to work out how long you need\
1898-
/// to sample for at a given ADC clock frequency
1898+
/// to sample for at a given ADC clock frequency
18991899
pub fn configure_channel<CHANNEL>(&mut self, _channel: &CHANNEL, sequence: config::Sequence, sample_time: config::SampleTime)
19001900
where
19011901
CHANNEL: Channel<stm32::$adc_type, ID=u8>
@@ -2406,7 +2406,7 @@ macro_rules! adc {
24062406
/// * `channel` - channel to configure
24072407
/// * `sequence` - where in the sequence to sample the channel. Also called rank in some STM docs/code
24082408
/// * `sample_time` - how long to sample for. See datasheet and ref manual to work out how long you need\
2409-
/// to sample for at a given ADC clock frequency
2409+
/// to sample for at a given ADC clock frequency
24102410
#[inline(always)]
24112411
pub fn configure_channel<CHANNEL>(&mut self, channel: &CHANNEL, sequence: config::Sequence, sample_time: config::SampleTime)
24122412
where

src/serial/usart.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use core::fmt;
1+
use core::fmt::{self, Debug};
22
use core::marker::PhantomData;
33

44
use crate::dma::{
@@ -139,20 +139,26 @@ pub trait SerialExt<USART, Config> {
139139

140140
impl<USART, TX, RX> fmt::Write for Serial<USART, TX, RX>
141141
where
142-
Serial<USART, TX, RX>: embedded_hal_old::serial::Write<u8>,
142+
Self: embedded_hal_old::serial::Write<u8>,
143+
<Self as embedded_hal_old::serial::Write<u8>>::Error: Debug,
143144
{
144145
fn write_str(&mut self, s: &str) -> fmt::Result {
145-
let _ = s.as_bytes().iter().map(|c| block!(self.write(*c))).last();
146+
for c in s.as_bytes() {
147+
block!(self.write(*c)).unwrap(); // self.write does not fail
148+
}
146149
Ok(())
147150
}
148151
}
149152

150153
impl<USART, Pin, Dma> fmt::Write for Tx<USART, Pin, Dma>
151154
where
152-
Tx<USART, Pin, Dma>: embedded_hal_old::serial::Write<u8>,
155+
Self: embedded_hal_old::serial::Write<u8>,
156+
<Self as embedded_hal_old::serial::Write<u8>>::Error: Debug,
153157
{
154158
fn write_str(&mut self, s: &str) -> fmt::Result {
155-
let _ = s.as_bytes().iter().map(|c| block!(self.write(*c))).last();
159+
for c in s.as_bytes() {
160+
block!(self.write(*c)).unwrap(); // self.write does not fail
161+
}
156162
Ok(())
157163
}
158164
}

0 commit comments

Comments
 (0)