Browse Source

Fix up a few remaining clippy errors

pull/16/head
Ian Chamberlain 2 years ago
parent
commit
b05a1e3ff3
No known key found for this signature in database
GPG Key ID: AE5484D09405AA60
  1. 10
      citro3d/src/attrib.rs
  2. 10
      citro3d/src/buffer.rs
  3. 2
      citro3d/src/lib.rs

10
citro3d/src/attrib.rs

@ -32,8 +32,8 @@ pub enum Format {
unsafe impl Sync for Info {} unsafe impl Sync for Info {}
unsafe impl Send for Info {} unsafe impl Send for Info {}
impl Info { impl Default for Info {
pub fn new() -> Self { fn default() -> Self {
let mut raw = MaybeUninit::zeroed(); let mut raw = MaybeUninit::zeroed();
let raw = unsafe { let raw = unsafe {
citro3d_sys::AttrInfo_Init(raw.as_mut_ptr()); citro3d_sys::AttrInfo_Init(raw.as_mut_ptr());
@ -41,6 +41,12 @@ impl Info {
}; };
Self(raw) Self(raw)
} }
}
impl Info {
pub fn new() -> Self {
Self::default()
}
pub(crate) fn copy_from(raw: *const citro3d_sys::C3D_AttrInfo) -> Option<Self> { pub(crate) fn copy_from(raw: *const citro3d_sys::C3D_AttrInfo) -> Option<Self> {
if raw.is_null() { if raw.is_null() {

10
citro3d/src/buffer.rs

@ -38,8 +38,8 @@ pub enum Primitive {
GeometryPrim = ctru_sys::GPU_GEOMETRY_PRIM, GeometryPrim = ctru_sys::GPU_GEOMETRY_PRIM,
} }
impl Info { impl Default for Info {
pub fn new() -> Self { fn default() -> Self {
let mut info = MaybeUninit::zeroed(); let mut info = MaybeUninit::zeroed();
let info = unsafe { let info = unsafe {
citro3d_sys::BufInfo_Init(info.as_mut_ptr()); citro3d_sys::BufInfo_Init(info.as_mut_ptr());
@ -47,6 +47,12 @@ impl Info {
}; };
Self(info) Self(info)
} }
}
impl Info {
pub fn new() -> Self {
Self::default()
}
pub(crate) fn copy_from(raw: *const citro3d_sys::C3D_BufInfo) -> Option<Self> { pub(crate) fn copy_from(raw: *const citro3d_sys::C3D_BufInfo) -> Option<Self> {
if raw.is_null() { if raw.is_null() {

2
citro3d/src/lib.rs

@ -1,5 +1,3 @@
#![feature(once_cell)]
//! Safe Rust bindings to `citro3d`. //! Safe Rust bindings to `citro3d`.
pub mod attrib; pub mod attrib;

Loading…
Cancel
Save