Skip to content

Commit 6c5177e

Browse files
committed
chore: lint fix [gen]
1 parent 06c3d11 commit 6c5177e

File tree

2 files changed

+11
-18
lines changed

2 files changed

+11
-18
lines changed

src/main.rs

-5
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ use std::env;
55
use std::error::Error;
66
use std::fs;
77
use std::process::exit;
8-
use std::thread::sleep;
9-
use std::time::Duration;
108

119
mod addr_register;
1210
mod bus;
@@ -22,14 +20,11 @@ mod utility;
2220
use bus::Bus;
2321
use gamepad::GamepadButtons;
2422
use ppu::Frame;
25-
use ppu::Ppu;
2623
use rand::random;
2724
use rom::Rom;
2825
use sdl2::event::Event;
2926
use sdl2::keyboard::Keycode;
30-
use sdl2::pixels::Color;
3127
use sdl2::pixels::PixelFormatEnum;
32-
use sdl2::EventPump;
3328

3429
struct KeyboardInput {
3530
key_map: HashMap<Keycode, GamepadButtons>,

src/ppu.rs

+11-13
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ use bitflags::bitflags;
22

33
use crate::{
44
addr_register::AddrRegister,
5-
palette::{self, SYSTEM_PALETTE},
5+
palette::{SYSTEM_PALETTE},
66
rom::Mirroring,
7-
utility::{addr_from, split_addr},
87
};
98

109
// TODO: move UI rendering stuff that ties to SDL2 out of PPU
@@ -221,7 +220,7 @@ impl Ppu {
221220
let p_idx = palette_idx.0;
222221
assert!(p_idx < 8);
223222

224-
let start = (p_idx * 4) as usize;
223+
let start = (p_idx * 4);
225224
[
226225
// The first entry is a special case
227226
if is_background { self.palettes[0] } else { 0 },
@@ -507,7 +506,8 @@ impl Ppu {
507506
let name_table_idx = base / 0x0400;
508507

509508
// and ROM-configured mirroring
510-
let mirrored = match (self.mirroring, name_table_idx) {
509+
510+
match (self.mirroring, name_table_idx) {
511511
(Mirroring::Horizontal, 1) | (Mirroring::Horizontal, 2) => base - 0x0400,
512512
(Mirroring::Vertical, 2) | (Mirroring::Vertical, 3) | (Mirroring::Horizontal, 3) => {
513513
base - 0x0800
@@ -516,8 +516,7 @@ impl Ppu {
516516
(Mirroring::FourScreen, _) => {
517517
todo!("Four Screen requires specicial setup with more RAM. More info: https://www.nesdev.org/wiki/Mirroring#4-Screen")
518518
}
519-
};
520-
mirrored
519+
}
521520
}
522521

523522
pub fn write_to_data(&mut self, data: u8) {
@@ -693,20 +692,19 @@ mod tests {
693692

694693
assert_eq!(ppu.get_tick_status(), (0, 0));
695694
assert_eq!(ppu.nmi_interrupt, None);
696-
assert_eq!(
697-
ppu.registers.status.contains(StatusRegister::VBLANK_FLAG),
698-
false,
695+
assert!(
696+
!ppu.registers.status.contains(StatusRegister::VBLANK_FLAG),
699697
);
700-
assert_eq!(ppu.is_vblank_nmi_enabled(), false);
698+
assert!(!ppu.is_vblank_nmi_enabled());
701699

702700
ppu.registers
703701
.control
704702
.insert(ControlRegister::VBLANK_NMI_ENABLE);
705-
assert_eq!(ppu.is_vblank_nmi_enabled(), true);
703+
assert!(ppu.is_vblank_nmi_enabled());
706704

707-
ppu.tick(1 * 341);
705+
ppu.tick(341);
708706
assert_eq!(ppu.get_tick_status(), (1, 341));
709-
assert_eq!(get_ppu_vblank_status(&mut ppu), false);
707+
assert!(!get_ppu_vblank_status(&mut ppu));
710708

711709
let should_rerender = ppu.tick(240 * 341);
712710
assert_eq!(ppu.get_tick_status(), (241, 241 * 341));

0 commit comments

Comments
 (0)