Skip to content

Commit 506bc99

Browse files
committed
Fix some clippy warnings
1 parent d13db0c commit 506bc99

File tree

16 files changed

+35
-36
lines changed

16 files changed

+35
-36
lines changed

src/adc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ macro_rules! adc_hal {
597597
#[cfg(not(feature = "revision_v"))]
598598
let f_target = f_adc.raw();
599599

600-
let (divider, presc) = match (ker_ck.raw() + f_target - 1) / f_target {
600+
let (divider, presc) = match ker_ck.raw().div_ceil(f_target) {
601601
1 => (1, PRESC_A::Div1),
602602
2 => (2, PRESC_A::Div2),
603603
3..=4 => (4, PRESC_A::Div4),

src/delay.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ impl<'a> Countdown<'a> {
110110
}
111111
}
112112

113-
impl<'a> CountDown for Countdown<'a> {
113+
impl CountDown for Countdown<'_> {
114114
type Time = fugit::MicrosDurationU32;
115115

116116
fn start<T>(&mut self, count: T)

src/dma/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -992,9 +992,9 @@ where
992992
/// MDMA block. The length is referred to the source size
993993
///
994994
/// * `s_len`: The number of input words of s_size available. `None` if the
995-
/// source is a peripheral
995+
/// source is a peripheral
996996
/// * `d_len`: The number of input words of d_size available. `None` if the
997-
/// destination is a peripheral
997+
/// destination is a peripheral
998998
///
999999
/// `s_len` and `d_len` cannot both be peripherals (None)
10001000
fn m_number_of_bytes(
@@ -1052,24 +1052,24 @@ where
10521052
/// # Panics
10531053
///
10541054
/// * When a memory-memory transfer is specified but the `second_buf`
1055-
/// argument is `None`.
1055+
/// argument is `None`.
10561056
///
10571057
/// * When the length is greater than 65536 bytes.
10581058
///
10591059
/// * When `config` specifies a `source_increment` that is smaller than the
1060-
/// source size.
1060+
/// source size.
10611061
///
10621062
/// * When `config` specifies a `destination_increment` that is smaller than
1063-
/// the destination size.
1063+
/// the destination size.
10641064
///
10651065
/// * When `config` specifies a `transfer_length` that is not a multiple of
1066-
/// both the source and destination sizes.
1066+
/// both the source and destination sizes.
10671067
///
10681068
/// * When `config` specifies a `packing_alignment` that extends the source,
1069-
/// but the source size is larger than the destination size.
1069+
/// but the source size is larger than the destination size.
10701070
///
10711071
/// * When `config` specifies a `packing_alignment` that truncates the
1072-
/// source, but the source size is smaller than the destination size.
1072+
/// source, but the source size is smaller than the destination size.
10731073
pub fn init_master(
10741074
mut stream: STREAM,
10751075
peripheral: PERIPHERAL,

src/dma/traits.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ pub trait MasterStream: Stream + Sealed {
193193
/// # Safety
194194
///
195195
/// Must have the same alignment as configured for the transfer
196-
197196
unsafe fn set_source_address(&mut self, value: usize);
198197

199198
/// Set the destination for the Master DMA stream

src/ethernet/eth.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@ impl StationManagement for EthernetMAC {
796796
/// Define TxToken type and implement consume method
797797
pub struct TxToken<'a, const TD: usize>(&'a mut TDesRing<TD>);
798798

799-
impl<'a, const TD: usize> phy::TxToken for TxToken<'a, TD> {
799+
impl<const TD: usize> phy::TxToken for TxToken<'_, TD> {
800800
fn consume<R, F>(self, len: usize, f: F) -> R
801801
where
802802
F: FnOnce(&mut [u8]) -> R,
@@ -812,7 +812,7 @@ impl<'a, const TD: usize> phy::TxToken for TxToken<'a, TD> {
812812
/// Define RxToken type and implement consume method
813813
pub struct RxToken<'a, const RD: usize>(&'a mut RDesRing<RD>);
814814

815-
impl<'a, const RD: usize> phy::RxToken for RxToken<'a, RD> {
815+
impl<const RD: usize> phy::RxToken for RxToken<'_, RD> {
816816
fn consume<R, F>(self, f: F) -> R
817817
where
818818
F: FnOnce(&[u8]) -> R,

src/flash/operations.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,10 @@ impl UnlockedFlashBank<'_> {
270270
}
271271
}
272272

273-
impl<'a> ErrorType for UnlockedFlashBank<'a> {
273+
impl ErrorType for UnlockedFlashBank<'_> {
274274
type Error = Error;
275275
}
276-
impl<'a> ReadNorFlash for UnlockedFlashBank<'a> {
276+
impl ReadNorFlash for UnlockedFlashBank<'_> {
277277
const READ_SIZE: usize = 1;
278278

279279
fn read(
@@ -291,7 +291,7 @@ impl<'a> ReadNorFlash for UnlockedFlashBank<'a> {
291291
}
292292
}
293293

294-
impl<'a> NorFlash for UnlockedFlashBank<'a> {
294+
impl NorFlash for UnlockedFlashBank<'_> {
295295
const WRITE_SIZE: usize = super::WRITE_SIZE;
296296
const ERASE_SIZE: usize = super::SECTOR_SIZE;
297297

src/fmc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ impl FmcExt for stm32::FMC {
126126
// Calculate kernel clock
127127
let fmc_ker_ck = match clk_sel {
128128
rec::FmcClkSel::RccHclk3 => {
129-
Some(clocks.hclk()).expect("FMC: HCLK must be enabled")
129+
clocks.hclk()
130130
}
131131
rec::FmcClkSel::Pll1Q => {
132132
clocks.pll1_q_ck().expect("FMC: PLL1_Q must be enabled")

src/gpio.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@
2727
//! - **Dynamic**: Pin mode is selected at runtime. See changing configurations for more details
2828
//! - Input
2929
//! - **PullUp**: Input connected to high with a weak pull up resistor. Will be high when nothing
30-
//! is connected
30+
//! is connected
3131
//! - **PullDown**: Input connected to high with a weak pull up resistor. Will be low when nothing
32-
//! is connected
32+
//! is connected
3333
//! - **Floating**: Input not pulled to high or low. Will be undefined when nothing is connected
3434
//! - Output
3535
//! - **PushPull**: Output which either drives the pin high or low
3636
//! - **OpenDrain**: Output which leaves the gate floating, or pulls it do ground in drain
37-
//! mode. Can be used as an input in the `open` configuration
37+
//! mode. Can be used as an input in the `open` configuration
3838
//!
3939
//! ## Changing modes
4040
//! The simplest way to change the pin mode is to use the `into_<mode>` functions. These return a

src/qei.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ macro_rules! tim_hal {
186186
tim.smcr.write(|w| { w.sms().bits(3) });
187187

188188
#[allow(unused_unsafe)] // method is safe for some timers
189-
tim.arr.write(|w| unsafe { w.bits(core::u32::MAX) });
189+
tim.arr.write(|w| unsafe { w.bits(u32::MAX) });
190190
tim.cr1.write(|w| w.cen().set_bit());
191191

192192
Qei { tim }

src/rcc/mco.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ macro_rules! calculate_prescaler {
4444
// Running?
4545
if let Some(freq) = self.frequency {
4646
// Calculate prescaler
47-
let prescaler = match (in_ck + freq - 1) / freq {
47+
let prescaler = match in_ck.div_ceil(freq) {
4848
0 => unreachable!(),
4949
x @ 1..=15 => x,
5050
_ => {

0 commit comments

Comments
 (0)