Browse Source

Handle #[must_use] errors where needed

pull/62/head
Ian Chamberlain 3 years ago
parent
commit
eb1f112c81
No known key found for this signature in database
GPG Key ID: AE5484D09405AA60
  1. 14
      ctru-rs/src/lib.rs
  2. 6
      ctru-rs/src/services/fs.rs
  3. 2
      ctru-rs/src/services/soc.rs

14
ctru-rs/src/lib.rs

@ -22,16 +22,22 @@ pub fn init() {
linker_fix_3ds::init(); linker_fix_3ds::init();
pthread_3ds::init(); pthread_3ds::init();
#[cfg(not(test))]
panic_hook_setup();
// Initialize the PS service for random data generation // Initialize the PS service for random data generation
unsafe { unsafe {
ctru_sys::psInit(); let ps_ret = ctru_sys::psInit();
if ctru_sys::R_FAILED(ps_ret) {
panic!(
"Failed to initialize random data generation: {:?}",
Error::from(ps_ret)
)
}
// Setup the deconstruction at the program's end // Setup the deconstruction at the program's end
libc::atexit(services_deinit); libc::atexit(services_deinit);
} }
#[cfg(not(test))]
panic_hook_setup();
} }
#[cfg(not(test))] #[cfg(not(test))]

6
ctru-rs/src/services/fs.rs

@ -996,7 +996,7 @@ impl Drop for Fs {
impl Drop for Archive { impl Drop for Archive {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { unsafe {
ctru_sys::FSUSER_CloseArchive(self.handle); let _ = ctru_sys::FSUSER_CloseArchive(self.handle);
} }
} }
} }
@ -1004,7 +1004,7 @@ impl Drop for Archive {
impl Drop for File { impl Drop for File {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { unsafe {
ctru_sys::FSFILE_Close(self.handle); let _ = ctru_sys::FSFILE_Close(self.handle);
} }
} }
} }
@ -1012,7 +1012,7 @@ impl Drop for File {
impl Drop for Dir { impl Drop for Dir {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { unsafe {
ctru_sys::FSDIR_Close(self.0); let _ = ctru_sys::FSDIR_Close(self.0);
} }
} }
} }

2
ctru-rs/src/services/soc.rs

@ -50,7 +50,7 @@ impl Soc {
// Surely nothing bad will happens :D // Surely nothing bad will happens :D
|| unsafe { || unsafe {
// The socket buffer is freed automatically by `socExit` // The socket buffer is freed automatically by `socExit`
ctru_sys::socExit(); let _ = ctru_sys::socExit();
}, },
)?; )?;

Loading…
Cancel
Save