Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clippy, bump usb #575

Merged
merged 1 commit into from
Jan 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 4 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Changed

- Bump `synopsys-usb-otg` to 0.3.2 (bug fix)
- Update readme, clippy fixes

- `OutPortX` (X = 2..8) and `OutPortArray` structures which can handle several pins at once [#426]

### Added

[#426]: https://github.com/stm32-rs/stm32f4xx-hal/pull/426
### Added

- `OutPortX` (X = 2..8) and `OutPortArray` structures which can handle several pins at once [#426]
- `restore` for `ErasedPin` and `PartiallyErasedPin`
-
[#426]: https://github.com/stm32-rs/stm32f4xx-hal/pull/426

## [v0.14.0] - 2022-12-12

Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ cortex-m-rt = "0.7.1"
nb = "1"
rand_core = "0.6.3"
stm32f4 = "0.15.1"
synopsys-usb-otg = { version = "0.3.1", features = ["cortex-m"], optional = true }
synopsys-usb-otg = { version = "0.3.2", features = ["cortex-m"], optional = true }
sdio-host = { version = "0.6.0", optional = true }
embedded-dma = "0.2.0"
bare-metal = { version = "1" }
Expand Down Expand Up @@ -74,7 +74,7 @@ usb-device = "0.2.9"
usbd-serial = "0.1.1"
micromath = "2"
cortex-m-rtic = "1.1.3"
dwt-systick-monotonic = "1.0"
dwt-systick-monotonic = "1.1"
st7789 = "0.7.0"
panic-rtt-target = { version = "0.1.2", features = ["cortex-m"] }
rtt-target = { version = "0.3.1", features = ["cortex-m"] }
Expand Down
2 changes: 1 addition & 1 deletion examples/analog-stopwatch-with-spi-ssd1306.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ fn format_elapsed(buf: &mut String<10>, elapsed: u32) {
let minutes = elapsed_to_m(elapsed);
let seconds = elapsed_to_s(elapsed);
let millis = elapsed_to_ms(elapsed);
write!(buf, "{}:{:02}.{:03}", minutes, seconds, millis).unwrap();
write!(buf, "{minutes}:{seconds:02}.{millis:03}").unwrap();
}

fn elapsed_to_ms(elapsed: u32) -> u32 {
Expand Down
4 changes: 2 additions & 2 deletions examples/rng-display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use ssd1306::{prelude::*, I2CDisplayInterface, Ssd1306};
use hal::{i2c::I2c, pac, prelude::*};
use rand_core::RngCore;

use core::fmt;
use core::fmt::Write;
use heapless::String;

// dimensions of SSD1306 OLED display known to work
Expand Down Expand Up @@ -93,7 +93,7 @@ fn main() -> ! {
let rand_val = rand_source.next_u32();

format_buf.clear();
if fmt::write(&mut format_buf, format_args!("{}", rand_val)).is_ok() {
if write!(&mut format_buf, "{rand_val}").is_ok() {
let text_style = MonoTextStyleBuilder::new()
.font(&FONT_5X8)
.text_color(BinaryColor::On)
Expand Down
2 changes: 1 addition & 1 deletion examples/serial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fn main() -> ! {

loop {
// print some value every 500 ms, value will overflow after 255
writeln!(tx, "value: {:02}\r", value).unwrap();
writeln!(tx, "value: {value:02}\r").unwrap();
value = value.wrapping_add(1);
delay.delay(2.secs());
}
Expand Down
12 changes: 8 additions & 4 deletions examples/stopwatch-with-ssd1306-and-interrupts-and-dma-i2c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
//!
//! Video of this example running: https://imgur.com/a/lQTQFLy

#![allow(clippy::empty_loop)]
#![allow(clippy::empty_loop, clippy::new_without_default)]
#![no_std]
#![no_main]

Expand Down Expand Up @@ -100,7 +100,9 @@ impl DMAI2cInterface {

impl WriteOnlyDataCommand for DMAI2cInterface {
fn send_commands(&mut self, cmd: DataFormat<'_>) -> Result<(), DisplayError> {
while COMMAND_SEND.load(Ordering::SeqCst) {}
while COMMAND_SEND.load(Ordering::SeqCst) {
core::hint::spin_loop()
}

match cmd {
DataFormat::U8(slice) => {
Expand Down Expand Up @@ -129,7 +131,9 @@ impl WriteOnlyDataCommand for DMAI2cInterface {
}

fn send_data(&mut self, buf: DataFormat<'_>) -> Result<(), DisplayError> {
while DRAWING.load(Ordering::SeqCst) {}
while DRAWING.load(Ordering::SeqCst) {
core::hint::spin_loop()
}

match buf {
DataFormat::U8(slice) => {
Expand Down Expand Up @@ -352,7 +356,7 @@ fn format_elapsed(buf: &mut String<10>, elapsed: u32) {
let minutes = elapsed_to_m(elapsed);
let seconds = elapsed_to_s(elapsed);
let millis = elapsed_to_ms(elapsed);
write!(buf, "{}:{:02}.{:03}", minutes, seconds, millis).unwrap();
write!(buf, "{minutes}:{seconds:02}.{millis:03}").unwrap();
}

fn elapsed_to_ms(elapsed: u32) -> u32 {
Expand Down
2 changes: 1 addition & 1 deletion examples/stopwatch-with-ssd1306-and-interrupts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ fn format_elapsed(buf: &mut String<10>, elapsed: u32) {
let minutes = elapsed_to_m(elapsed);
let seconds = elapsed_to_s(elapsed);
let millis = elapsed_to_ms(elapsed);
write!(buf, "{}:{:02}.{:03}", minutes, seconds, millis).unwrap();
write!(buf, "{minutes}:{seconds:02}.{millis:03}").unwrap();
}

fn elapsed_to_ms(elapsed: u32) -> u32 {
Expand Down
4 changes: 2 additions & 2 deletions src/i2c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -575,10 +575,10 @@ impl<I2C: Instance, PINS> I2c<I2C, PINS> {
Ok(())
}

pub fn transaction_slice<'a>(
pub fn transaction_slice(
&mut self,
addr: u8,
ops_slice: &mut [Operation<'a>],
ops_slice: &mut [Operation<'_>],
) -> Result<(), Error> {
let mut ops = ops_slice.iter_mut();

Expand Down
4 changes: 2 additions & 2 deletions src/i2c/hal_1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ mod blocking {
self.write_iter_read(addr, bytes, buffer)
}

fn transaction<'a>(
fn transaction(
&mut self,
addr: u8,
operations: &mut [Operation<'a>],
operations: &mut [Operation<'_>],
) -> Result<(), Self::Error> {
self.transaction_slice(addr, operations)
}
Expand Down
2 changes: 1 addition & 1 deletion src/spi/hal_02.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ mod blocking {
{
type Error = Error;

fn exec<'a>(&mut self, operations: &mut [Operation<'a, W>]) -> Result<(), Error> {
fn exec(&mut self, operations: &mut [Operation<'_, W>]) -> Result<(), Error> {
for op in operations {
match op {
Operation::Write(w) => self.write(w)?,
Expand Down