Skip to content

Commit 1d3d5d2

Browse files
committed
Fix lints and formatting
1 parent faaf6f4 commit 1d3d5d2

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

citro3d/src/buffer.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ use std::mem::MaybeUninit;
77

88
use ctru::linear::LinearAllocator;
99

10-
use crate::attrib;
1110
use crate::Error;
11+
use crate::attrib;
1212

1313
/// Vertex buffer info. This struct is used to describe the shape of the buffer
1414
/// data to be sent to the GPU for rendering.
@@ -57,7 +57,7 @@ impl Slice<'_> {
5757
/// Returns an error if:
5858
/// - any of the given indices are out of bounds.
5959
/// - the given slice is too long for its length to fit in a `libc::c_int`.
60-
pub fn index_buffer<I>(&self, indices: &[I]) -> Result<Indices<I>, Error>
60+
pub fn index_buffer<I>(&self, indices: &[I]) -> Result<Indices<'_, I>, Error>
6161
where
6262
I: Index + Copy + Into<libc::c_int>,
6363
{
@@ -83,7 +83,7 @@ impl Slice<'_> {
8383
///
8484
/// If any indices are outside this buffer it can cause an invalid access by the GPU
8585
/// (this crashes citra).
86-
pub unsafe fn index_buffer_unchecked<I: Index + Clone>(&self, indices: &[I]) -> Indices<I> {
86+
pub unsafe fn index_buffer_unchecked<I: Index + Clone>(&self, indices: &[I]) -> Indices<'_, I> {
8787
let mut buffer = Vec::with_capacity_in(indices.len(), LinearAllocator);
8888
buffer.extend_from_slice(indices);
8989
Indices {

citro3d/src/lib.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -223,20 +223,22 @@ impl Instance {
223223
&mut self,
224224
primitive: buffer::Primitive,
225225
vbo_data: buffer::Slice,
226-
indices: &Indices<I>,
226+
indices: &Indices<'_, I>,
227227
) {
228228
self.set_buffer_info(vbo_data.info());
229229

230230
let indices = &indices.buffer;
231231
let elements = indices.as_ptr().cast();
232232

233-
citro3d_sys::C3D_DrawElements(
234-
primitive as ctru_sys::GPU_Primitive_t,
235-
indices.len().try_into().unwrap(),
236-
// flag bit for short or byte
237-
I::TYPE,
238-
elements,
239-
);
233+
unsafe {
234+
citro3d_sys::C3D_DrawElements(
235+
primitive as ctru_sys::GPU_Primitive_t,
236+
indices.len().try_into().unwrap(),
237+
// flag bit for short or byte
238+
I::TYPE,
239+
elements,
240+
);
241+
}
240242
}
241243

242244
/// Use the given [`shader::Program`] for subsequent draw calls.

0 commit comments

Comments
 (0)