summaryrefslogtreecommitdiff
path: root/examples/nrf/src/bin/rng.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2022-06-13 07:22:04 +0000
committerGitHub <noreply@github.com>2022-06-13 07:22:04 +0000
commitdb685c04049449ac3e4f256f2e7e26dad550d94c (patch)
treef4ec5de70ec05e793a774049e010935ac45853ed /examples/nrf/src/bin/rng.rs
parentfff0a03fe0f9e84209dd40fd8f93790871d03d75 (diff)
parenta8703b75988e1e700af701116464025679d2feb8 (diff)
downloadembassy-db685c04049449ac3e4f256f2e7e26dad550d94c.zip
Merge #808
808: Add rustfmt.toml with some nice settings. r=lulf a=Dirbaio Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
Diffstat (limited to 'examples/nrf/src/bin/rng.rs')
-rw-r--r--examples/nrf/src/bin/rng.rs17
1 files changed, 4 insertions, 13 deletions
diff --git a/examples/nrf/src/bin/rng.rs b/examples/nrf/src/bin/rng.rs
index 4b4b3a19..08d3abe1 100644
--- a/examples/nrf/src/bin/rng.rs
+++ b/examples/nrf/src/bin/rng.rs
@@ -3,13 +3,10 @@
#![feature(type_alias_impl_trait)]
use embassy::executor::Spawner;
-use embassy_nrf::interrupt;
use embassy_nrf::rng::Rng;
-use embassy_nrf::Peripherals;
+use embassy_nrf::{interrupt, Peripherals};
use rand::Rng as _;
-
-use defmt_rtt as _; // global logger
-use panic_probe as _;
+use {defmt_rtt as _, panic_probe as _};
#[embassy::main]
async fn main(_spawner: Spawner, p: Peripherals) {
@@ -27,12 +24,6 @@ async fn main(_spawner: Spawner, p: Peripherals) {
rng.fill_bytes(&mut bytes).await;
let zero_count: u32 = bytes.iter().fold(0, |acc, val| acc + val.count_zeros());
let one_count: u32 = bytes.iter().fold(0, |acc, val| acc + val.count_ones());
- defmt::info!(
- "Chance of zero: {}%",
- zero_count * 100 / (bytes.len() as u32 * 8)
- );
- defmt::info!(
- "Chance of one: {}%",
- one_count * 100 / (bytes.len() as u32 * 8)
- );
+ defmt::info!("Chance of zero: {}%", zero_count * 100 / (bytes.len() as u32 * 8));
+ defmt::info!("Chance of one: {}%", one_count * 100 / (bytes.len() as u32 * 8));
}