Browse Source

Cargo fmt

pull/90/head
Andrea Ciliberti 2 years ago
parent
commit
a2aab6a577
  1. 3
      ctru-rs/src/linear.rs
  2. 4
      ctru-rs/src/services/ps.rs

3
ctru-rs/src/linear.rs

@ -29,8 +29,7 @@ impl LinearAllocator {
unsafe impl Allocator for LinearAllocator { unsafe impl Allocator for LinearAllocator {
fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError> { fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError> {
let pointer = let pointer = unsafe { ctru_sys::linearMemAlign(layout.size(), layout.align()) };
unsafe { ctru_sys::linearMemAlign(layout.size(), layout.align()) };
NonNull::new(pointer.cast()) NonNull::new(pointer.cast())
.map(|ptr| NonNull::slice_from_raw_parts(ptr, layout.size())) .map(|ptr| NonNull::slice_from_raw_parts(ptr, layout.size()))

4
ctru-rs/src/services/ps.rs

@ -45,9 +45,7 @@ pub fn device_id() -> crate::Result<u32> {
} }
pub fn generate_random_bytes(out: &mut [u8]) -> crate::Result<()> { pub fn generate_random_bytes(out: &mut [u8]) -> crate::Result<()> {
ResultCode(unsafe { ResultCode(unsafe { ctru_sys::PS_GenerateRandomBytes(out as *mut _ as *mut _, out.len()) })?;
ctru_sys::PS_GenerateRandomBytes(out as *mut _ as *mut _, out.len())
})?;
Ok(()) Ok(())
} }

Loading…
Cancel
Save