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. 10
      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 @@ -140,8 +140,8 @@ fn rotate_image_to_screen(src: &[u8], framebuf: *mut u8, width: usize, height: u
unsafe {
// 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.
let pixel_pointer = framebuf.offset(draw_index as isize);
pixel_pointer.copy_from(src.as_ptr().offset(read_index as isize), 2);
let pixel_pointer = framebuf.add(draw_index);
pixel_pointer.copy_from(src.as_ptr().add(read_index), 2);
}
}
}

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

@ -58,19 +58,17 @@ fn main() { @@ -58,19 +58,17 @@ fn main() {
if hid.keys_down().intersects(KeyPad::DOWN) {
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;
} else if hid.keys_down().intersects(KeyPad::UP) && offset > 0 {
offset -= 1;
refresh = true;
}
}
// Render the title list via a scrollable text UI.
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.
top_screen.select();

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

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

Loading…
Cancel
Save