Skip to content

Commit ef6bdc2

Browse files
authored
Merge pull request #450 from stm32-rs/clippy
clippy examples
2 parents 348f947 + 990b2f5 commit ef6bdc2

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

examples/blinky-timer-irq.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ fn main() -> ! {
9292
cortex_m::peripheral::NVIC::unmask(Interrupt::TIM2);
9393
}
9494

95+
#[allow(clippy::empty_loop)]
9596
loop {
9697
// Uncomment if you want to make controller sleep
9798
// cortex_m::asm::wfi();

examples/hd44780.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,6 @@ fn main() -> ! {
4949
.unwrap();
5050
lcd.write_str("Hello, world!", &mut delay).unwrap();
5151

52+
#[allow(clippy::empty_loop)]
5253
loop {}
5354
}

examples/spi_dma.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ fn main() -> ! {
5151

5252
let buffer = cortex_m::singleton!(: [u8; ARRAY_SIZE] = [1; ARRAY_SIZE]).unwrap();
5353

54-
for i in 0..ARRAY_SIZE {
55-
buffer[i] = i as u8;
54+
for (i, b) in buffer.iter_mut().enumerate() {
55+
*b = i as u8;
5656
}
5757

5858
let tx = spi2.use_dma().tx();
@@ -100,8 +100,8 @@ fn DMA2_STREAM4() {
100100
transfer.clear_transfer_complete_interrupt();
101101
unsafe {
102102
static mut BUFFER: [u8; ARRAY_SIZE] = [0; ARRAY_SIZE];
103-
for i in 0..ARRAY_SIZE {
104-
BUFFER[i] = (i + 1) as u8;
103+
for (i, b) in BUFFER.iter_mut().enumerate() {
104+
*b = (i + 1) as u8;
105105
}
106106
transfer.next_transfer(&mut BUFFER).unwrap();
107107
}

0 commit comments

Comments
 (0)