diff options
author | 2020-10-26 21:54:36 +0100 | |
---|---|---|
committer | 2020-10-26 22:00:22 +0100 | |
commit | 9b5a6eafc1f394d819636e60859b3c679b34ff50 (patch) | |
tree | b475f6504c07c55d1eebb3008617e32c317a6e2b /cortex-m-semihosting | |
parent | 3166eb5a7158ed643d0fb6bc2809013d2e6ba402 (diff) | |
download | cortex-m-9b5a6eafc1f394d819636e60859b3c679b34ff50.tar.gz cortex-m-9b5a6eafc1f394d819636e60859b3c679b34ff50.tar.zst cortex-m-9b5a6eafc1f394d819636e60859b3c679b34ff50.zip |
Format everything
Diffstat (limited to 'cortex-m-semihosting')
-rw-r--r-- | cortex-m-semihosting/src/hio.rs | 9 | ||||
-rw-r--r-- | cortex-m-semihosting/src/lib.rs | 4 | ||||
-rw-r--r-- | cortex-m-semihosting/src/macros.rs | 9 |
3 files changed, 9 insertions, 13 deletions
diff --git a/cortex-m-semihosting/src/hio.rs b/cortex-m-semihosting/src/hio.rs index b0ca2fb..b6b6c7b 100644 --- a/cortex-m-semihosting/src/hio.rs +++ b/cortex-m-semihosting/src/hio.rs @@ -1,7 +1,7 @@ //! Host I/O -use core::{fmt, slice}; use crate::nr; +use core::{fmt, slice}; /// A byte stream to the host (e.g., host's stdout or stderr). #[derive(Clone, Copy)] @@ -38,8 +38,7 @@ pub fn hstdout() -> Result<HostStream, ()> { fn open(name: &str, mode: usize) -> Result<HostStream, ()> { let name = name.as_bytes(); - match unsafe { syscall!(OPEN, name.as_ptr(), mode, name.len() - 1) } as - isize { + match unsafe { syscall!(OPEN, name.as_ptr(), mode, name.len() - 1) } as isize { -1 => Err(()), fd => Ok(HostStream { fd: fd as usize }), } @@ -53,9 +52,7 @@ fn write_all(fd: usize, mut buffer: &[u8]) -> Result<(), ()> { // `n` bytes were not written n if n <= buffer.len() => { let offset = (buffer.len() - n) as isize; - buffer = unsafe { - slice::from_raw_parts(buffer.as_ptr().offset(offset), n) - } + buffer = unsafe { slice::from_raw_parts(buffer.as_ptr().offset(offset), n) } } #[cfg(feature = "jlink-quirks")] // Error (-1) - should be an error but JLink can return -1, -2, -3,... diff --git a/cortex-m-semihosting/src/lib.rs b/cortex-m-semihosting/src/lib.rs index de52ae1..05455ce 100644 --- a/cortex-m-semihosting/src/lib.rs +++ b/cortex-m-semihosting/src/lib.rs @@ -218,9 +218,7 @@ pub unsafe fn syscall1(_nr: usize, _arg: usize) -> usize { } #[cfg(all(thumb, feature = "no-semihosting"))] - () => { - 0 - } + () => 0, #[cfg(not(thumb))] () => unimplemented!(), diff --git a/cortex-m-semihosting/src/macros.rs b/cortex-m-semihosting/src/macros.rs index d10cd3f..f1cc4f3 100644 --- a/cortex-m-semihosting/src/macros.rs +++ b/cortex-m-semihosting/src/macros.rs @@ -11,12 +11,13 @@ macro_rules! syscall { $crate::syscall($crate::nr::$nr, &[$a1 as usize, $a2 as usize]) }; ($nr:ident, $a1:expr, $a2:expr, $a3:expr) => { - $crate::syscall($crate::nr::$nr, &[$a1 as usize, $a2 as usize, - $a3 as usize]) + $crate::syscall($crate::nr::$nr, &[$a1 as usize, $a2 as usize, $a3 as usize]) }; ($nr:ident, $a1:expr, $a2:expr, $a3:expr, $a4:expr) => { - $crate::syscall($crate::nr::$nr, &[$a1 as usize, $a2 as usize, - $a3 as usize, $a4 as usize]) + $crate::syscall( + $crate::nr::$nr, + &[$a1 as usize, $a2 as usize, $a3 as usize, $a4 as usize], + ) }; } |