clippy autofix

This commit is contained in:
Corwin 2022-10-08 11:34:43 +01:00
parent e01a3c41b6
commit c90e8de893
4 changed files with 7 additions and 7 deletions

View file

@ -43,7 +43,7 @@ impl BumpAllocator {
let resulting_ptr = ptr + amount_to_add; let resulting_ptr = ptr + amount_to_add;
let new_current_ptr = resulting_ptr + layout.size(); let new_current_ptr = resulting_ptr + layout.size();
if new_current_ptr as usize >= (self.start_end.borrow(cs).end)() { if new_current_ptr >= (self.start_end.borrow(cs).end)() {
return None; return None;
} }

View file

@ -627,7 +627,7 @@ impl ObjectController {
unsafe { unsafe {
(OBJECT_ATTRIBUTE_MEMORY as *mut u16) (OBJECT_ATTRIBUTE_MEMORY as *mut u16)
.add((i as usize) * 4) .add(i * 4)
.write_volatile(HIDDEN_VALUE); .write_volatile(HIDDEN_VALUE);
} }
@ -794,7 +794,7 @@ impl ObjectController {
}); });
let loan = Loan { let loan = Loan {
index: index as u8, index,
phantom: PhantomData, phantom: PhantomData,
}; };
@ -916,8 +916,8 @@ impl<'a> Object<'a> {
/// [ObjectController::commit] is called. /// [ObjectController::commit] is called.
pub fn set_x(&mut self, x: u16) -> &mut Self { pub fn set_x(&mut self, x: u16) -> &mut Self {
let object_inner = unsafe { self.object_inner() }; let object_inner = unsafe { self.object_inner() };
object_inner.attrs.a1a.set_x(x.rem_euclid(1 << 9) as u16); object_inner.attrs.a1a.set_x(x.rem_euclid(1 << 9));
object_inner.attrs.a1s.set_x(x.rem_euclid(1 << 9) as u16); object_inner.attrs.a1s.set_x(x.rem_euclid(1 << 9));
self self
} }

View file

@ -224,7 +224,7 @@ impl VRamManager {
slice::from_raw_parts_mut( slice::from_raw_parts_mut(
tiles tiles
.as_mut_ptr() .as_mut_ptr()
.add((index * tile_format.tile_size()) as usize) .add(index * tile_format.tile_size())
.cast(), .cast(),
tile_format.tile_size() / core::mem::size_of::<u32>(), tile_format.tile_size() / core::mem::size_of::<u32>(),
) )

View file

@ -51,7 +51,7 @@ fn set_bank(bank: u8) -> Result<(), Error> {
Err(Error::OutOfBounds) Err(Error::OutOfBounds)
} else if bank != CURRENT_BANK.read() { } else if bank != CURRENT_BANK.read() {
issue_flash_command(CMD_SET_BANK); issue_flash_command(CMD_SET_BANK);
FLASH_PORT_BANK.set(bank as u8); FLASH_PORT_BANK.set(bank);
CURRENT_BANK.write(bank); CURRENT_BANK.write(bank);
Ok(()) Ok(())
} else { } else {