From a8703b75988e1e700af701116464025679d2feb8 Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Sun, 12 Jun 2022 22:15:44 +0200 Subject: Run rustfmt. --- examples/boot/nrf/src/bin/a.rs | 14 ++++---------- examples/boot/nrf/src/bin/b.rs | 7 ++----- examples/boot/stm32f3/src/bin/a.rs | 10 +++------- examples/boot/stm32f3/src/bin/b.rs | 5 ++--- examples/boot/stm32f7/src/bin/a.rs | 10 +++------- examples/boot/stm32f7/src/bin/b.rs | 5 ++--- examples/boot/stm32h7/src/bin/a.rs | 10 +++------- examples/boot/stm32h7/src/bin/b.rs | 5 ++--- examples/boot/stm32l0/src/bin/a.rs | 10 +++------- examples/boot/stm32l0/src/bin/b.rs | 5 ++--- examples/boot/stm32l1/src/bin/a.rs | 10 +++------- examples/boot/stm32l1/src/bin/b.rs | 5 ++--- examples/boot/stm32l4/src/bin/a.rs | 10 +++------- examples/boot/stm32l4/src/bin/b.rs | 5 ++--- examples/boot/stm32wl/src/bin/a.rs | 10 +++------- examples/boot/stm32wl/src/bin/b.rs | 5 ++--- 16 files changed, 41 insertions(+), 85 deletions(-) (limited to 'examples/boot') diff --git a/examples/boot/nrf/src/bin/a.rs b/examples/boot/nrf/src/bin/a.rs index d45d0ff34..0b9715e49 100644 --- a/examples/boot/nrf/src/bin/a.rs +++ b/examples/boot/nrf/src/bin/a.rs @@ -6,12 +6,9 @@ use embassy_boot_nrf::FirmwareUpdater; use embassy_embedded_hal::adapter::BlockingAsync; -use embassy_nrf::{ - gpio::{Input, Pull}, - gpio::{Level, Output, OutputDrive}, - nvmc::Nvmc, - Peripherals, -}; +use embassy_nrf::gpio::{Input, Level, Output, OutputDrive, Pull}; +use embassy_nrf::nvmc::Nvmc; +use embassy_nrf::Peripherals; use panic_reset as _; static APP_B: &[u8] = include_bytes!("../../b.bin"); @@ -35,10 +32,7 @@ async fn main(_s: embassy::executor::Spawner, p: Peripherals) { for chunk in APP_B.chunks(4096) { let mut buf: [u8; 4096] = [0; 4096]; buf[..chunk.len()].copy_from_slice(chunk); - updater - .write_firmware(offset, &buf, &mut nvmc, 4096) - .await - .unwrap(); + updater.write_firmware(offset, &buf, &mut nvmc, 4096).await.unwrap(); offset += chunk.len(); } updater.update(&mut nvmc).await.unwrap(); diff --git a/examples/boot/nrf/src/bin/b.rs b/examples/boot/nrf/src/bin/b.rs index 18bb6330c..a06c20f8b 100644 --- a/examples/boot/nrf/src/bin/b.rs +++ b/examples/boot/nrf/src/bin/b.rs @@ -5,11 +5,8 @@ #![feature(type_alias_impl_trait)] use embassy::time::{Duration, Timer}; -use embassy_nrf::{ - gpio::{Level, Output, OutputDrive}, - Peripherals, -}; - +use embassy_nrf::gpio::{Level, Output, OutputDrive}; +use embassy_nrf::Peripherals; use panic_reset as _; #[embassy::main] diff --git a/examples/boot/stm32f3/src/bin/a.rs b/examples/boot/stm32f3/src/bin/a.rs index 9ad798389..4ff18d7c7 100644 --- a/examples/boot/stm32f3/src/bin/a.rs +++ b/examples/boot/stm32f3/src/bin/a.rs @@ -2,6 +2,8 @@ #![no_main] #![feature(type_alias_impl_trait)] +#[cfg(feature = "defmt-rtt")] +use defmt_rtt::*; use embassy_boot_stm32::FirmwareUpdater; use embassy_embedded_hal::adapter::BlockingAsync; use embassy_stm32::exti::ExtiInput; @@ -10,9 +12,6 @@ use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; use embassy_stm32::Peripherals; use panic_reset as _; -#[cfg(feature = "defmt-rtt")] -use defmt_rtt::*; - static APP_B: &[u8] = include_bytes!("../../b.bin"); #[embassy::main] @@ -32,10 +31,7 @@ async fn main(_s: embassy::executor::Spawner, p: Peripherals) { for chunk in APP_B.chunks(2048) { let mut buf: [u8; 2048] = [0; 2048]; buf[..chunk.len()].copy_from_slice(chunk); - updater - .write_firmware(offset, &buf, &mut flash, 2048) - .await - .unwrap(); + updater.write_firmware(offset, &buf, &mut flash, 2048).await.unwrap(); offset += chunk.len(); } updater.update(&mut flash).await.unwrap(); diff --git a/examples/boot/stm32f3/src/bin/b.rs b/examples/boot/stm32f3/src/bin/b.rs index 814275988..4487e586e 100644 --- a/examples/boot/stm32f3/src/bin/b.rs +++ b/examples/boot/stm32f3/src/bin/b.rs @@ -2,15 +2,14 @@ #![no_main] #![feature(type_alias_impl_trait)] +#[cfg(feature = "defmt-rtt")] +use defmt_rtt::*; use embassy::executor::Spawner; use embassy::time::{Duration, Timer}; use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_stm32::Peripherals; use panic_reset as _; -#[cfg(feature = "defmt-rtt")] -use defmt_rtt::*; - #[embassy::main] async fn main(_spawner: Spawner, p: Peripherals) { let mut led = Output::new(p.PA5, Level::High, Speed::Low); diff --git a/examples/boot/stm32f7/src/bin/a.rs b/examples/boot/stm32f7/src/bin/a.rs index b4f49d579..9c7921a1a 100644 --- a/examples/boot/stm32f7/src/bin/a.rs +++ b/examples/boot/stm32f7/src/bin/a.rs @@ -2,6 +2,8 @@ #![no_main] #![feature(type_alias_impl_trait)] +#[cfg(feature = "defmt-rtt")] +use defmt_rtt::*; use embassy_boot_stm32::FirmwareUpdater; use embassy_embedded_hal::adapter::BlockingAsync; use embassy_stm32::exti::ExtiInput; @@ -10,9 +12,6 @@ use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; use embassy_stm32::Peripherals; use panic_reset as _; -#[cfg(feature = "defmt-rtt")] -use defmt_rtt::*; - static APP_B: &[u8] = include_bytes!("../../b.bin"); #[embassy::main] @@ -32,10 +31,7 @@ async fn main(_s: embassy::executor::Spawner, p: Peripherals) { let mut buf: [u8; 256 * 1024] = [0; 256 * 1024]; for chunk in APP_B.chunks(256 * 1024) { buf[..chunk.len()].copy_from_slice(chunk); - updater - .write_firmware(offset, &buf, &mut flash, 2048) - .await - .unwrap(); + updater.write_firmware(offset, &buf, &mut flash, 2048).await.unwrap(); offset += chunk.len(); } updater.update(&mut flash).await.unwrap(); diff --git a/examples/boot/stm32f7/src/bin/b.rs b/examples/boot/stm32f7/src/bin/b.rs index ed37137f5..aa05bbcdd 100644 --- a/examples/boot/stm32f7/src/bin/b.rs +++ b/examples/boot/stm32f7/src/bin/b.rs @@ -2,15 +2,14 @@ #![no_main] #![feature(type_alias_impl_trait)] +#[cfg(feature = "defmt-rtt")] +use defmt_rtt::*; use embassy::executor::Spawner; use embassy::time::{Duration, Timer}; use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_stm32::Peripherals; use panic_reset as _; -#[cfg(feature = "defmt-rtt")] -use defmt_rtt::*; - #[embassy::main] async fn main(_spawner: Spawner, p: Peripherals) { Timer::after(Duration::from_millis(300)).await; diff --git a/examples/boot/stm32h7/src/bin/a.rs b/examples/boot/stm32h7/src/bin/a.rs index 1d196e8a5..704979dba 100644 --- a/examples/boot/stm32h7/src/bin/a.rs +++ b/examples/boot/stm32h7/src/bin/a.rs @@ -2,6 +2,8 @@ #![no_main] #![feature(type_alias_impl_trait)] +#[cfg(feature = "defmt-rtt")] +use defmt_rtt::*; use embassy_boot_stm32::FirmwareUpdater; use embassy_embedded_hal::adapter::BlockingAsync; use embassy_stm32::exti::ExtiInput; @@ -10,9 +12,6 @@ use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; use embassy_stm32::Peripherals; use panic_reset as _; -#[cfg(feature = "defmt-rtt")] -use defmt_rtt::*; - static APP_B: &[u8] = include_bytes!("../../b.bin"); #[embassy::main] @@ -32,10 +31,7 @@ async fn main(_s: embassy::executor::Spawner, p: Peripherals) { let mut buf: [u8; 128 * 1024] = [0; 128 * 1024]; for chunk in APP_B.chunks(128 * 1024) { buf[..chunk.len()].copy_from_slice(chunk); - updater - .write_firmware(offset, &buf, &mut flash, 2048) - .await - .unwrap(); + updater.write_firmware(offset, &buf, &mut flash, 2048).await.unwrap(); offset += chunk.len(); } updater.update(&mut flash).await.unwrap(); diff --git a/examples/boot/stm32h7/src/bin/b.rs b/examples/boot/stm32h7/src/bin/b.rs index 233b93e1a..ea0140253 100644 --- a/examples/boot/stm32h7/src/bin/b.rs +++ b/examples/boot/stm32h7/src/bin/b.rs @@ -2,15 +2,14 @@ #![no_main] #![feature(type_alias_impl_trait)] +#[cfg(feature = "defmt-rtt")] +use defmt_rtt::*; use embassy::executor::Spawner; use embassy::time::{Duration, Timer}; use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_stm32::Peripherals; use panic_reset as _; -#[cfg(feature = "defmt-rtt")] -use defmt_rtt::*; - #[embassy::main] async fn main(_spawner: Spawner, p: Peripherals) { Timer::after(Duration::from_millis(300)).await; diff --git a/examples/boot/stm32l0/src/bin/a.rs b/examples/boot/stm32l0/src/bin/a.rs index d4b252bf0..ce620347b 100644 --- a/examples/boot/stm32l0/src/bin/a.rs +++ b/examples/boot/stm32l0/src/bin/a.rs @@ -2,6 +2,8 @@ #![no_main] #![feature(type_alias_impl_trait)] +#[cfg(feature = "defmt-rtt")] +use defmt_rtt::*; use embassy::time::{Duration, Timer}; use embassy_boot_stm32::FirmwareUpdater; use embassy_embedded_hal::adapter::BlockingAsync; @@ -11,9 +13,6 @@ use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; use embassy_stm32::Peripherals; use panic_reset as _; -#[cfg(feature = "defmt-rtt")] -use defmt_rtt::*; - static APP_B: &[u8] = include_bytes!("../../b.bin"); #[embassy::main] @@ -34,10 +33,7 @@ async fn main(_s: embassy::executor::Spawner, p: Peripherals) { for chunk in APP_B.chunks(128) { let mut buf: [u8; 128] = [0; 128]; buf[..chunk.len()].copy_from_slice(chunk); - updater - .write_firmware(offset, &buf, &mut flash, 128) - .await - .unwrap(); + updater.write_firmware(offset, &buf, &mut flash, 128).await.unwrap(); offset += chunk.len(); } diff --git a/examples/boot/stm32l0/src/bin/b.rs b/examples/boot/stm32l0/src/bin/b.rs index ed774fd70..0b585a14c 100644 --- a/examples/boot/stm32l0/src/bin/b.rs +++ b/examples/boot/stm32l0/src/bin/b.rs @@ -2,15 +2,14 @@ #![no_main] #![feature(type_alias_impl_trait)] +#[cfg(feature = "defmt-rtt")] +use defmt_rtt::*; use embassy::executor::Spawner; use embassy::time::{Duration, Timer}; use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_stm32::Peripherals; use panic_reset as _; -#[cfg(feature = "defmt-rtt")] -use defmt_rtt::*; - #[embassy::main] async fn main(_spawner: Spawner, p: Peripherals) { let mut led = Output::new(p.PB6, Level::High, Speed::Low); diff --git a/examples/boot/stm32l1/src/bin/a.rs b/examples/boot/stm32l1/src/bin/a.rs index d4b252bf0..ce620347b 100644 --- a/examples/boot/stm32l1/src/bin/a.rs +++ b/examples/boot/stm32l1/src/bin/a.rs @@ -2,6 +2,8 @@ #![no_main] #![feature(type_alias_impl_trait)] +#[cfg(feature = "defmt-rtt")] +use defmt_rtt::*; use embassy::time::{Duration, Timer}; use embassy_boot_stm32::FirmwareUpdater; use embassy_embedded_hal::adapter::BlockingAsync; @@ -11,9 +13,6 @@ use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; use embassy_stm32::Peripherals; use panic_reset as _; -#[cfg(feature = "defmt-rtt")] -use defmt_rtt::*; - static APP_B: &[u8] = include_bytes!("../../b.bin"); #[embassy::main] @@ -34,10 +33,7 @@ async fn main(_s: embassy::executor::Spawner, p: Peripherals) { for chunk in APP_B.chunks(128) { let mut buf: [u8; 128] = [0; 128]; buf[..chunk.len()].copy_from_slice(chunk); - updater - .write_firmware(offset, &buf, &mut flash, 128) - .await - .unwrap(); + updater.write_firmware(offset, &buf, &mut flash, 128).await.unwrap(); offset += chunk.len(); } diff --git a/examples/boot/stm32l1/src/bin/b.rs b/examples/boot/stm32l1/src/bin/b.rs index ed774fd70..0b585a14c 100644 --- a/examples/boot/stm32l1/src/bin/b.rs +++ b/examples/boot/stm32l1/src/bin/b.rs @@ -2,15 +2,14 @@ #![no_main] #![feature(type_alias_impl_trait)] +#[cfg(feature = "defmt-rtt")] +use defmt_rtt::*; use embassy::executor::Spawner; use embassy::time::{Duration, Timer}; use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_stm32::Peripherals; use panic_reset as _; -#[cfg(feature = "defmt-rtt")] -use defmt_rtt::*; - #[embassy::main] async fn main(_spawner: Spawner, p: Peripherals) { let mut led = Output::new(p.PB6, Level::High, Speed::Low); diff --git a/examples/boot/stm32l4/src/bin/a.rs b/examples/boot/stm32l4/src/bin/a.rs index 23b1d98bb..bf6099355 100644 --- a/examples/boot/stm32l4/src/bin/a.rs +++ b/examples/boot/stm32l4/src/bin/a.rs @@ -2,6 +2,8 @@ #![no_main] #![feature(type_alias_impl_trait)] +#[cfg(feature = "defmt-rtt")] +use defmt_rtt::*; use embassy_boot_stm32::FirmwareUpdater; use embassy_embedded_hal::adapter::BlockingAsync; use embassy_stm32::exti::ExtiInput; @@ -10,9 +12,6 @@ use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; use embassy_stm32::Peripherals; use panic_reset as _; -#[cfg(feature = "defmt-rtt")] -use defmt_rtt::*; - static APP_B: &[u8] = include_bytes!("../../b.bin"); #[embassy::main] @@ -32,10 +31,7 @@ async fn main(_s: embassy::executor::Spawner, p: Peripherals) { for chunk in APP_B.chunks(2048) { let mut buf: [u8; 2048] = [0; 2048]; buf[..chunk.len()].copy_from_slice(chunk); - updater - .write_firmware(offset, &buf, &mut flash, 2048) - .await - .unwrap(); + updater.write_firmware(offset, &buf, &mut flash, 2048).await.unwrap(); offset += chunk.len(); } updater.update(&mut flash).await.unwrap(); diff --git a/examples/boot/stm32l4/src/bin/b.rs b/examples/boot/stm32l4/src/bin/b.rs index 814275988..4487e586e 100644 --- a/examples/boot/stm32l4/src/bin/b.rs +++ b/examples/boot/stm32l4/src/bin/b.rs @@ -2,15 +2,14 @@ #![no_main] #![feature(type_alias_impl_trait)] +#[cfg(feature = "defmt-rtt")] +use defmt_rtt::*; use embassy::executor::Spawner; use embassy::time::{Duration, Timer}; use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_stm32::Peripherals; use panic_reset as _; -#[cfg(feature = "defmt-rtt")] -use defmt_rtt::*; - #[embassy::main] async fn main(_spawner: Spawner, p: Peripherals) { let mut led = Output::new(p.PA5, Level::High, Speed::Low); diff --git a/examples/boot/stm32wl/src/bin/a.rs b/examples/boot/stm32wl/src/bin/a.rs index 1089eff1e..dc1eb9bed 100644 --- a/examples/boot/stm32wl/src/bin/a.rs +++ b/examples/boot/stm32wl/src/bin/a.rs @@ -2,6 +2,8 @@ #![no_main] #![feature(type_alias_impl_trait)] +#[cfg(feature = "defmt-rtt")] +use defmt_rtt::*; use embassy_boot_stm32::FirmwareUpdater; use embassy_embedded_hal::adapter::BlockingAsync; use embassy_stm32::exti::ExtiInput; @@ -10,9 +12,6 @@ use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; use embassy_stm32::Peripherals; use panic_reset as _; -#[cfg(feature = "defmt-rtt")] -use defmt_rtt::*; - static APP_B: &[u8] = include_bytes!("../../b.bin"); #[embassy::main] @@ -34,10 +33,7 @@ async fn main(_s: embassy::executor::Spawner, p: Peripherals) { let mut buf: [u8; 2048] = [0; 2048]; buf[..chunk.len()].copy_from_slice(chunk); // defmt::info!("Writing chunk at 0x{:x}", offset); - updater - .write_firmware(offset, &buf, &mut flash, 2048) - .await - .unwrap(); + updater.write_firmware(offset, &buf, &mut flash, 2048).await.unwrap(); offset += chunk.len(); } updater.update(&mut flash).await.unwrap(); diff --git a/examples/boot/stm32wl/src/bin/b.rs b/examples/boot/stm32wl/src/bin/b.rs index ffe15b661..f2344bd53 100644 --- a/examples/boot/stm32wl/src/bin/b.rs +++ b/examples/boot/stm32wl/src/bin/b.rs @@ -2,15 +2,14 @@ #![no_main] #![feature(type_alias_impl_trait)] +#[cfg(feature = "defmt-rtt")] +use defmt_rtt::*; use embassy::executor::Spawner; use embassy::time::{Duration, Timer}; use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_stm32::Peripherals; use panic_reset as _; -#[cfg(feature = "defmt-rtt")] -use defmt_rtt::*; - #[embassy::main] async fn main(_spawner: Spawner, p: Peripherals) { let mut led = Output::new(p.PB15, Level::High, Speed::Low); -- cgit