From 9b97e904846237869da325396e38ff934349b10a Mon Sep 17 00:00:00 2001 From: Andrea Ciliberti Date: Fri, 7 Jul 2023 13:20:19 +0200 Subject: [PATCH] Renew manifests and fix warnings --- Cargo.toml | 1 + ctru-rs/Cargo.toml | 4 +++- ctru-rs/src/error.rs | 16 ++++++++-------- ctru-rs/src/lib.rs | 7 +++---- ctru-rs/src/services/gfx.rs | 2 +- ctru-rs/src/services/romfs.rs | 2 +- ctru-sys/Cargo.toml | 4 ++++ 7 files changed, 21 insertions(+), 15 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index af22c84..33abd1c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,7 @@ [workspace] members = ["ctru-rs", "ctru-sys", "ctru-sys/bindgen-ctru-sys"] default-members = ["ctru-rs", "ctru-sys"] +resolver = "2" [patch.'https://github.com/rust3ds/ctru-rs'] # Make sure all dependencies use the local ctru-sys package diff --git a/ctru-rs/Cargo.toml b/ctru-rs/Cargo.toml index 8049fea..69f88f4 100644 --- a/ctru-rs/Cargo.toml +++ b/ctru-rs/Cargo.toml @@ -1,12 +1,14 @@ [package] authors = ["Rust3DS Org", "Ronald Kinard "] description = "A safe wrapper around libctru" +keywords = ["3ds", "libctru"] +categories = ["os", "api-bindings"] license = "Zlib" name = "ctru-rs" version = "0.7.1" edition = "2021" repository = "https://github.com/rust3ds/ctru-rs" -rust-version = "1.64" +rust-version = "1.70" [lib] crate-type = ["rlib"] diff --git a/ctru-rs/src/error.rs b/ctru-rs/src/error.rs index 9e1f3c5..71c0f46 100644 --- a/ctru-rs/src/error.rs +++ b/ctru-rs/src/error.rs @@ -1,5 +1,5 @@ //! Error handling interface. -//! +//! //! This module holds the generic error and result types to interface with [`ctru_sys`] and the safe wrapper. use std::borrow::Cow; use std::error; @@ -10,16 +10,16 @@ use std::ops::{ControlFlow, FromResidual, Try}; use ctru_sys::result::{R_DESCRIPTION, R_LEVEL, R_MODULE, R_SUMMARY}; /// Custom type alias for generic `ctru` operations. -/// +/// /// This type is compatible with `ctru-sys` result codes. pub type Result = ::std::result::Result; /// Validity checker of raw [`ctru_sys::Result`] codes. -/// +/// /// This struct supports the "try" syntax (`?`) to convert to an [`Error::Os`]. -/// +/// /// # Example -/// +/// /// ```no_run /// pub fn hid_init() -> crate::Result<()> { /// // We run an unsafe function which returns a `ctru_sys::Result`. @@ -71,13 +71,13 @@ impl FromResidual for Result { } /// The generic error enum returned by `ctru` functions. -/// +/// /// This error enum supports parsing and displaying [`ctru_sys::Result`] codes. #[non_exhaustive] pub enum Error { /// Raw [`ctru_sys::Result`] codes. Os(ctru_sys::Result), - /// Generic `libc` error codes. + /// Generic `libc` error codes. Libc(String), /// Requested service is already active and cannot be activated again. ServiceAlreadyActive, @@ -94,7 +94,7 @@ pub enum Error { impl Error { /// Create an [`Error`] out of the last set value in `errno`. - /// + /// /// This can be used to get a human-readable error string from calls to `libc` functions. pub(crate) fn from_errno() -> Self { let error_str = unsafe { diff --git a/ctru-rs/src/lib.rs b/ctru-rs/src/lib.rs index 713705e..f2f3e7c 100644 --- a/ctru-rs/src/lib.rs +++ b/ctru-rs/src/lib.rs @@ -25,7 +25,6 @@ #![feature(custom_test_frameworks)] #![feature(try_trait_v2)] #![feature(allocator_api)] -#![feature(nonnull_slice_from_raw_parts)] #![test_runner(test_runner::run)] #![doc( html_favicon_url = "https://user-images.githubusercontent.com/11131775/225929072-2fa1741c-93ae-4b47-9bdf-af70f3d59910.png" @@ -39,7 +38,7 @@ extern crate pthread_3ds; extern crate shim_3ds; /// Expanded stack size used to spawn the main thread by `libctru`. -/// +/// /// This value was chosen to support crate dependencies which expected more stack than provided, without compromising performance. #[no_mangle] #[cfg(feature = "big-stack")] @@ -69,9 +68,9 @@ pub fn use_panic_handler() { } /// Internal protocol to activate the custom panic handler hook. -/// +/// /// # Notes -/// +/// /// When `test` is enabled, this function will be ignored. #[cfg(not(test))] fn panic_hook_setup() { diff --git a/ctru-rs/src/services/gfx.rs b/ctru-rs/src/services/gfx.rs index a7ba708..dd6fbff 100644 --- a/ctru-rs/src/services/gfx.rs +++ b/ctru-rs/src/services/gfx.rs @@ -134,7 +134,7 @@ impl Flush for S { let framebuffer = self.raw_framebuffer(); // Flush the data array. `self.raw_framebuffer` should get the correct parameters for all kinds of screens - unsafe { + let _ = unsafe { ctru_sys::GSPGPU_FlushDataCache( framebuffer.ptr.cast(), (framebuffer.height * framebuffer.width) as u32, diff --git a/ctru-rs/src/services/romfs.rs b/ctru-rs/src/services/romfs.rs index 49369a6..c87b884 100644 --- a/ctru-rs/src/services/romfs.rs +++ b/ctru-rs/src/services/romfs.rs @@ -36,7 +36,7 @@ impl RomFS { }, || { let mount_name = CStr::from_bytes_with_nul(b"romfs\0").unwrap(); - unsafe { ctru_sys::romfsUnmount(mount_name.as_ptr()) }; + let _ = unsafe { ctru_sys::romfsUnmount(mount_name.as_ptr()) }; }, )?; diff --git a/ctru-sys/Cargo.toml b/ctru-sys/Cargo.toml index d4cb24b..03435b6 100644 --- a/ctru-sys/Cargo.toml +++ b/ctru-sys/Cargo.toml @@ -2,9 +2,13 @@ name = "ctru-sys" version = "22.2.0+2.2.2-1" authors = [ "Rust3DS Org", "Ronald Kinard " ] +description = "Raw bindings to libctru" +keywords = ["3ds", "libctru"] +categories = ["os", "external-ffi-bindings", "no-std"] license = "Zlib" links = "ctru" edition = "2021" +repository = "https://github.com/rust3ds/ctru-rs" [dependencies] libc = { version = "0.2.121", default-features = false }