From a727feb11c6a9f83afc7006e451313d13a7bf3d7 Mon Sep 17 00:00:00 2001 From: Andrea Ciliberti Date: Wed, 3 Jan 2024 13:53:42 +0100 Subject: [PATCH] Fixed nits --- ctru-rs/examples/file-explorer.rs | 2 +- ctru-rs/src/applets/mii_selector.rs | 3 +-- ctru-rs/src/applets/swkbd.rs | 7 +++---- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/ctru-rs/examples/file-explorer.rs b/ctru-rs/examples/file-explorer.rs index 49855ab..5c158ac 100644 --- a/ctru-rs/examples/file-explorer.rs +++ b/ctru-rs/examples/file-explorer.rs @@ -165,7 +165,7 @@ impl<'a> FileExplorer<'a> { fn get_input_and_run(&mut self, action: impl FnOnce(&mut Self, String)) { let mut keyboard = SoftwareKeyboard::default(); - match keyboard.get_string(2048, &self.apt, &self.gfx) { + match keyboard.get_string(2048, self.apt, self.gfx) { Ok((path, Button::Right)) => { // Clicked "OK". action(self, path); diff --git a/ctru-rs/src/applets/mii_selector.rs b/ctru-rs/src/applets/mii_selector.rs index 079168e..43cdbb3 100644 --- a/ctru-rs/src/applets/mii_selector.rs +++ b/ctru-rs/src/applets/mii_selector.rs @@ -281,8 +281,7 @@ impl MiiSelector { /// # } /// ``` #[doc(alias = "miiSelectorLaunch")] - #[allow(unused_variables)] - pub fn launch(&mut self, apt: &Apt, gfx: &Gfx) -> Result { + pub fn launch(&mut self, _apt: &Apt, _gfx: &Gfx) -> Result { let mut return_val = Box::::default(); unsafe { ctru_sys::miiSelectorLaunch(self.config.as_mut(), return_val.as_mut()) } diff --git a/ctru-rs/src/applets/swkbd.rs b/ctru-rs/src/applets/swkbd.rs index 768d942..c6325e7 100644 --- a/ctru-rs/src/applets/swkbd.rs +++ b/ctru-rs/src/applets/swkbd.rs @@ -310,8 +310,7 @@ impl SoftwareKeyboard { /// # } /// ``` #[doc(alias = "swkbdInputText")] - #[allow(unused_variables)] - pub fn write_exact(&mut self, buf: &mut [u8], apt: &Apt, gfx: &Gfx) -> Result { + pub fn write_exact(&mut self, buf: &mut [u8], _apt: &Apt, _gfx: &Gfx) -> Result { unsafe { match ctru_sys::swkbdInputText(self.state.as_mut(), buf.as_mut_ptr(), buf.len()) { ctru_sys::SWKBD_BUTTON_NONE => Err(self.state.result.into()), @@ -407,7 +406,7 @@ impl SoftwareKeyboard { where F: FnOnce(&str) -> (CallbackResult, Option), { - let closure = Box::from_raw(user as *mut Box); + let closure: Box> = Box::from_raw(user.cast()); let text = CStr::from_ptr(text); let text_slice: &str = text.to_str().unwrap(); @@ -691,7 +690,7 @@ impl ParentalLock { #[allow(unused_variables)] pub fn launch(&mut self, apt: &Apt, gfx: &Gfx) -> Result<(), Error> { unsafe { - let mut buf = [0; 10]; + let mut buf = [0; 0]; ctru_sys::swkbdInputText(self.state.as_mut(), buf.as_mut_ptr(), 10); let e = self.state.result.into();