Skip to content

Commit f6615b0

Browse files
author
Jorge Aparicio
committed
reformat
1 parent 81c9d39 commit f6615b0

File tree

4 files changed

+58
-24
lines changed

4 files changed

+58
-24
lines changed

src/ctxt.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@ use core::cell::UnsafeCell;
55

66
/// Data local to a context
77
pub struct Local<T, Ctxt>
8-
where Ctxt: Context
8+
where
9+
Ctxt: Context,
910
{
1011
_ctxt: PhantomData<Ctxt>,
1112
data: UnsafeCell<T>,
1213
}
1314

1415
impl<T, Ctxt> Local<T, Ctxt>
15-
where Ctxt: Context
16+
where
17+
Ctxt: Context,
1618
{
1719
/// Initializes context local data
1820
pub const fn new(value: T) -> Self {
@@ -28,7 +30,11 @@ impl<T, Ctxt> Local<T, Ctxt>
2830
}
2931
}
3032

31-
unsafe impl<T, Ctxt> Sync for Local<T, Ctxt> where Ctxt: Context {}
33+
unsafe impl<T, Ctxt> Sync for Local<T, Ctxt>
34+
where
35+
Ctxt: Context,
36+
{
37+
}
3238

3339
/// A token unique to a context
3440
pub unsafe trait Context {}

src/macros.rs

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,49 @@
11
/// Macro for printing to the **host's** standard stderr
22
#[macro_export]
33
macro_rules! ehprint {
4-
($s:expr) => ($crate::semihosting:::io:ewrite_str($s));
5-
($($arg:tt)*) => ($crate::semihosting::io::ewrite_fmt(format_args!($($arg)*)));
4+
($s:expr) => {
5+
$crate::semihosting:::io:ewrite_str($s);
6+
};
7+
($($arg:tt)*) => {
8+
$crate::semihosting::io::ewrite_fmt(format_args!($($arg)*));
9+
};
610
}
711

812
/// Macro for printing to the **host's** standard error, with a newline.
913
#[macro_export]
1014
macro_rules! ehprintln {
1115
() => (ehprint!("\n"));
12-
($fmt:expr) => (ehprint!(concat!($fmt, "\n")));
13-
($fmt:expr, $($arg:tt)*) => (ehprint!(concat!($fmt, "\n"), $($arg)*));
16+
($fmt:expr) => {
17+
ehprint!(concat!($fmt, "\n"));
18+
};
19+
($fmt:expr, $($arg:tt)*) => {
20+
ehprint!(concat!($fmt, "\n"), $($arg)*);
21+
};
1422
}
1523

1624
/// Macro for printing to the **host's** standard output
1725
#[macro_export]
1826
macro_rules! hprint {
19-
($s:expr) => ($crate::semihosting::io::write_str($s));
20-
($($arg:tt)*) => ($crate::semihosting::io::write_fmt(format_args!($($arg)*)));
27+
($s:expr) => {
28+
$crate::semihosting::io::write_str($s);
29+
};
30+
($($arg:tt)*) => {
31+
$crate::semihosting::io::write_fmt(format_args!($($arg)*));
32+
};
2133
}
2234

2335
/// Macro for printing to the **host's** standard output, with a newline.
2436
#[macro_export]
2537
macro_rules! hprintln {
26-
() => (hprint!("\n"));
27-
($fmt:expr) => (hprint!(concat!($fmt, "\n")));
28-
($fmt:expr, $($arg:tt)*) => (hprint!(concat!($fmt, "\n"), $($arg)*));
38+
() => {
39+
hprint!("\n");
40+
};
41+
($fmt:expr) => {
42+
hprint!(concat!($fmt, "\n"));
43+
};
44+
($fmt:expr, $($arg:tt)*) => {
45+
hprint!(concat!($fmt, "\n"), $($arg)*);
46+
};
2947
}
3048

3149
/// Macro for sending a formatted string through an ITM channel

src/peripheral/mod.rs

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ pub const TPIU: Peripheral<Tpiu> = unsafe { Peripheral::new(0xE004_0000) };
5252

5353
/// A peripheral
5454
pub struct Peripheral<T>
55-
where T: 'static
55+
where
56+
T: 'static,
5657
{
5758
address: usize,
5859
_marker: PhantomData<&'static mut T>,
@@ -290,7 +291,8 @@ pub struct Nvic {
290291
impl Nvic {
291292
/// Clears `interrupt`'s pending state
292293
pub fn clear_pending<I>(&self, interrupt: I)
293-
where I: Nr
294+
where
295+
I: Nr,
294296
{
295297
let nr = interrupt.nr();
296298

@@ -299,7 +301,8 @@ impl Nvic {
299301

300302
/// Disables `interrupt`
301303
pub fn disable<I>(&self, interrupt: I)
302-
where I: Nr
304+
where
305+
I: Nr,
303306
{
304307
let nr = interrupt.nr();
305308

@@ -308,7 +311,8 @@ impl Nvic {
308311

309312
/// Enables `interrupt`
310313
pub fn enable<I>(&self, interrupt: I)
311-
where I: Nr
314+
where
315+
I: Nr,
312316
{
313317
let nr = interrupt.nr();
314318

@@ -321,7 +325,8 @@ impl Nvic {
321325
/// `1` and `2` have the same priority. Also for NVIC priorities, a lower
322326
/// value (e.g. `16`) has higher priority than a larger value (e.g. `32`).
323327
pub fn get_priority<I>(&self, interrupt: I) -> u8
324-
where I: Nr
328+
where
329+
I: Nr,
325330
{
326331
let nr = interrupt.nr();
327332

@@ -330,7 +335,8 @@ impl Nvic {
330335

331336
/// Is `interrupt` active or pre-empted and stacked
332337
pub fn is_active<I>(&self, interrupt: I) -> bool
333-
where I: Nr
338+
where
339+
I: Nr,
334340
{
335341
let nr = interrupt.nr();
336342
let mask = 1 << (nr % 32);
@@ -340,7 +346,8 @@ impl Nvic {
340346

341347
/// Checks if `interrupt` is enabled
342348
pub fn is_enabled<I>(&self, interrupt: I) -> bool
343-
where I: Nr
349+
where
350+
I: Nr,
344351
{
345352
let nr = interrupt.nr();
346353
let mask = 1 << (nr % 32);
@@ -350,7 +357,8 @@ impl Nvic {
350357

351358
/// Checks if `interrupt` is pending
352359
pub fn is_pending<I>(&self, interrupt: I) -> bool
353-
where I: Nr
360+
where
361+
I: Nr,
354362
{
355363
let nr = interrupt.nr();
356364
let mask = 1 << (nr % 32);
@@ -360,7 +368,8 @@ impl Nvic {
360368

361369
/// Forces `interrupt` into pending state
362370
pub fn set_pending<I>(&self, interrupt: I)
363-
where I: Nr
371+
where
372+
I: Nr,
364373
{
365374
let nr = interrupt.nr();
366375

@@ -372,7 +381,8 @@ impl Nvic {
372381
/// NOTE See `get_priority` method for an explanation of how NVIC priorities
373382
/// work.
374383
pub fn set_priority<I>(&self, interrupt: I, prio: u8)
375-
where I: Nr
384+
where
385+
I: Nr,
376386
{
377387
let nr = interrupt.nr();
378388

src/register/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
//! - MSP
99
//! - PRIMASK
1010
//!
11-
//! The rest of registers (see list below) can be accessed in either, PRIVILEGED or UNPRIVILEGED,
12-
//! mode.
11+
//! The rest of registers (see list below) can be accessed in either, PRIVILEGED
12+
//! or UNPRIVILEGED, mode.
1313
//!
1414
//! - APSR
1515
//! - LR

0 commit comments

Comments
 (0)