Skip to content

Commit 644e4f3

Browse files
committed
Clippy improve testsuite
1 parent 0d8077f commit 644e4f3

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

testsuite/tests/adc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ mod tests {
6565
defmt::debug!("{}", adc_level);
6666
defmt::unwrap!(state.output.set_low());
6767
// Vref is 3V so output should reach the maximum.
68-
assert!(adc_level >= 3500 && adc_level <= 4100);
68+
assert!((3500..4100).contains(&adc_level));
6969
let adc_level: u16 = defmt::unwrap!(adc.read(&mut state.analog).ok());
7070
defmt::debug!("{}", adc_level);
7171
// nearly zero (always zero can not be guaranteed)

testsuite/tests/uart.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,21 @@ use hal::{
2626

2727
use hal::interrupt;
2828

29-
use core::array::IntoIter;
3029
use defmt::{assert, assert_eq, unwrap};
3130

31+
use core::array::IntoIter;
3232
use core::sync::atomic::{AtomicBool, Ordering};
3333

3434
static INTERRUPT_FIRED: AtomicBool = AtomicBool::new(false);
3535

36+
type Serial1 = Serial<pac::USART1, (PA9<AF7<PushPull>>, PA10<AF7<PushPull>>)>;
37+
type SerialSlow = Serial<pac::USART2, (PA2<AF7<PushPull>>, PA3<AF7<OpenDrain>>)>;
38+
type SerialFast = Serial<pac::USART3, (PB10<AF7<PushPull>>, PB11<AF7<OpenDrain>>)>;
39+
3640
struct State {
37-
serial1: Option<Serial<pac::USART1, (PA9<AF7<PushPull>>, PA10<AF7<PushPull>>)>>,
38-
serial_slow: Option<Serial<pac::USART2, (PA2<AF7<PushPull>>, PA3<AF7<OpenDrain>>)>>,
39-
serial_fast: Option<Serial<pac::USART3, (PB10<AF7<PushPull>>, PB11<AF7<OpenDrain>>)>>,
41+
serial1: Option<Serial1>,
42+
serial_slow: Option<SerialSlow>,
43+
serial_fast: Option<SerialFast>,
4044
clocks: Clocks,
4145
apb1: APB1,
4246
apb2: APB2,

0 commit comments

Comments
 (0)