chore: update error messages in expect() calls

This commit is contained in:
Rekai Nyangadzayi Musuka 2021-07-08 18:50:58 -05:00
parent 4f3fc3136d
commit 9b3a5d49d2
4 changed files with 16 additions and 10 deletions

View File

@ -2277,13 +2277,13 @@ impl From<Cycle> for u32 {
impl InstrRegisterPair {
fn to_register_pair(self) -> RegisterPair {
RegisterPair::try_from(self).expect("Failed to convert InstrRegisterPair to RegisterPair")
RegisterPair::try_from(self).expect("InstrRegisterPair is a valid RegisterPair")
}
}
impl InstrRegister {
fn to_register(self) -> Register {
Register::try_from(self).expect("Failed to convert from InstrRegister to Register")
Register::try_from(self).expect("InstrRegister is a valid Register")
}
}

View File

@ -39,14 +39,16 @@ fn main() -> Result<()> {
// `rom` is a required value in every situation so this will
// always exist.
let rom_path = m.value_of("rom").unwrap();
let rom_path = m
.value_of("rom")
.expect("Required value 'rom' was provided");
let mut game_boy =
gb::emu::init(m.value_of("boot"), rom_path).expect("Failed to initialize DMG-01 Emulator");
gb::emu::init(m.value_of("boot"), rom_path).expect("Initialized DMG-01 Emulator");
let cartridge_title = gb::emu::rom_title(&game_boy);
// Initialize Gamepad Support
let mut gamepad = Gilrs::new().expect("Failed to initialize Gilrs");
let mut gamepad = Gilrs::new().expect("Initialized Gilrs for Controller Input");
// Initialize GUI
let event_loop = EventLoop::new();

View File

@ -278,7 +278,7 @@ impl Ppu {
.obj
.tile
.bytes()
.expect("Failed to unwrap Tile bytes");
.expect("Tile high & low bytes are present");
let tbpp = Pixels::from_bytes(high, low);
@ -539,7 +539,7 @@ impl ObjectAttributeTable {
let slice: &[u8; 4] = self.buf[start..(start + 4)]
.try_into()
.expect("Could not interpret &[u8] as a &[u8; 4]");
.expect("TryInto trait called on a &[u8; 4]");
slice.into()
}
@ -704,7 +704,7 @@ impl PixelFetcher {
let scroll_y = pos.scroll_y;
let is_window = self.back.is_window_tile();
let id = self.back.tile.id.expect("Tile Number unexpectedly missing");
let id = self.back.tile.id.expect("Tile Number is present");
let tile_data_addr = match control.tile_data_addr() {
TileDataAddress::X8800 => 0x9000u16.wrapping_add(((id as i8) as i16 * 16) as u16),
@ -721,7 +721,11 @@ impl PixelFetcher {
}
fn send_to_fifo(&self, fifo: &mut FifoRenderer, palette: &BackgroundPalette) {
let (high, low) = self.back.tile.bytes().expect("Failed to unwrap Tile bytes");
let (high, low) = self
.back
.tile
.bytes()
.expect("Tile high & low bytes are present");
let tbpp = Pixels::from_bytes(high, low);

View File

@ -30,7 +30,7 @@ impl DirectMemoryAccess {
.start
.addr
.as_mut()
.expect("DMA Transfer Attempted without a known source address");
.expect("Source Address present during DMA Transfer");
let addresses = if (self.cycle - 4) % 4 == 0 {
*src_addr += 1;