Browse Source

Even more lints

pull/137/head
Andrea Ciliberti 1 year ago
parent
commit
6afad4dceb
  1. 4
      ctru-rs/examples/camera-image.rs
  2. 12
      ctru-rs/examples/title-info.rs
  3. 2
      ctru-rs/src/services/romfs.rs

4
ctru-rs/examples/camera-image.rs

@ -140,8 +140,8 @@ fn rotate_image_to_screen(src: &[u8], framebuf: *mut u8, width: usize, height: u
unsafe { unsafe {
// We'll work with pointers since the framebuffer is a raw pointer regardless. // We'll work with pointers since the framebuffer is a raw pointer regardless.
// The offsets are completely safe as long as the width and height are correct. // The offsets are completely safe as long as the width and height are correct.
let pixel_pointer = framebuf.offset(draw_index as isize); let pixel_pointer = framebuf.add(draw_index);
pixel_pointer.copy_from(src.as_ptr().offset(read_index as isize), 2); pixel_pointer.copy_from(src.as_ptr().add(read_index), 2);
} }
} }
} }

12
ctru-rs/examples/title-info.rs

@ -58,19 +58,17 @@ fn main() {
if hid.keys_down().intersects(KeyPad::DOWN) { if hid.keys_down().intersects(KeyPad::DOWN) {
if offset + 1 < cur_list.len() { if offset + 1 < cur_list.len() {
offset = offset + 1; offset += 1;
refresh = true;
}
} else if hid.keys_down().intersects(KeyPad::UP) {
if offset > 0 {
offset = offset - 1;
refresh = true; refresh = true;
} }
} else if hid.keys_down().intersects(KeyPad::UP) && offset > 0 {
offset -= 1;
refresh = true;
} }
// Render the title list via a scrollable text UI. // Render the title list via a scrollable text UI.
if refresh { if refresh {
let mut selected_title = cur_list.iter().skip(offset).next().unwrap(); let mut selected_title = cur_list.iter().nth(offset).unwrap();
// Clear the top screen and write title IDs to it. // Clear the top screen and write title IDs to it.
top_screen.select(); top_screen.select();

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

@ -87,7 +87,7 @@ mod tests {
fn romfs_lock() { fn romfs_lock() {
let romfs = RomFS::new().unwrap(); let romfs = RomFS::new().unwrap();
let _value = *ROMFS_ACTIVE.try_lock().unwrap(); *ROMFS_ACTIVE.try_lock().unwrap();
drop(romfs); drop(romfs);
} }

Loading…
Cancel
Save