Skip to content

Commit 7ea5793

Browse files
committed
embedded: Run formatter
Run `cargo +nightly fmt` inside each of the two embedded test crates. Manually merge vec import statements. Done in preparation for patching these crates.
1 parent db157f9 commit 7ea5793

File tree

2 files changed

+10
-18
lines changed

2 files changed

+10
-18
lines changed

embedded/no-allocator/src/main.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@
77
#![no_main]
88
#![no_std]
99

10-
use panic_halt as _;
11-
1210
use arrayvec::{ArrayString, ArrayVec};
13-
use bech32::{self, u5, ComboError, FromBase32, ToBase32, Variant, Hrp};
11+
use bech32::{self, u5, ComboError, FromBase32, Hrp, ToBase32, Variant};
1412
use cortex_m_rt::entry;
1513
use cortex_m_semihosting::{debug, hprintln};
14+
use panic_halt as _;
1615

1716
// Note: `#[global_allocator]` is NOT set.
1817

@@ -26,9 +25,7 @@ fn main() -> ! {
2625

2726
let hrp = Hrp::parse("bech32").unwrap();
2827

29-
bech32::encode_to_fmt_anycase(&mut encoded, hrp, &base32, Variant::Bech32)
30-
.unwrap()
31-
.unwrap();
28+
bech32::encode_to_fmt_anycase(&mut encoded, hrp, &base32, Variant::Bech32).unwrap().unwrap();
3229
test(&*encoded == "bech321qqqsyrhqy2a");
3330

3431
hprintln!("{}", encoded).unwrap();

embedded/with-allocator/src/main.rs

+7-12
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
#![no_std]
44

55
extern crate alloc;
6-
use panic_halt as _;
7-
8-
use self::alloc::string::ToString;
9-
use self::alloc::vec;
10-
use self::alloc::vec::Vec;
116
use core::alloc::Layout;
127

138
use alloc_cortex_m::CortexMHeap;
14-
use bech32::{self, FromBase32, ToBase32, Variant, Hrp};
9+
use bech32::{self, FromBase32, Hrp, ToBase32, Variant};
1510
use cortex_m::asm;
1611
use cortex_m_rt::entry;
1712
use cortex_m_semihosting::{debug, hprintln};
13+
use panic_halt as _;
14+
15+
use self::alloc::string::ToString;
16+
use self::alloc::vec;
17+
use self::alloc::vec::Vec;
1818

1919
#[global_allocator]
2020
static ALLOCATOR: CortexMHeap = CortexMHeap::empty();
@@ -27,12 +27,7 @@ fn main() -> ! {
2727
unsafe { ALLOCATOR.init(cortex_m_rt::heap_start() as usize, HEAP_SIZE) }
2828

2929
let hrp = Hrp::parse("bech32").unwrap();
30-
let encoded = bech32::encode(
31-
hrp,
32-
vec![0x00, 0x01, 0x02].to_base32(),
33-
Variant::Bech32,
34-
)
35-
.unwrap();
30+
let encoded = bech32::encode(hrp, vec![0x00, 0x01, 0x02].to_base32(), Variant::Bech32).unwrap();
3631
test(encoded == "bech321qqqsyrhqy2a".to_string());
3732

3833
hprintln!("{}", encoded).unwrap();

0 commit comments

Comments
 (0)