Ongoing cleanup

This commit is contained in:
Kevin Hamacher 2020-02-20 19:31:41 +01:00
parent 847d12c3a8
commit 0f20b2801b
4 changed files with 8 additions and 8 deletions

View File

@ -78,7 +78,7 @@ impl Cartridge {
RamSize::Ram32KB => 16 * 2048,
};
if let &Some(ref filename) = savefile {
if let Some(ref filename) = *savefile {
let data = super::read_file(&filename);
if let Ok(data) = data {
if data.len() != size {

View File

@ -58,8 +58,8 @@ enum Args {
impl Args {
fn single_val(&self) -> u8 {
match self {
&Args::Single(x) => x,
match *self {
Args::Single(x) => x,
_ => panic!("single_val only works with Args::Single"),
}
}
@ -72,7 +72,7 @@ impl CPU {
regs: [0, 0, 0, 0, 0, 0, 0],
ip: 0,
sp: 0xFFFE,
interconnect: interconnect,
interconnect,
ime: false,
debug: false,
halted: false,

View File

@ -262,13 +262,13 @@ impl Display {
vram1: vec![0; VRAM_SIZE].into_boxed_slice(),
vram_bank: 0,
oam: vec![0; OAM_SIZE].into_boxed_slice(),
renderer: renderer,
renderer,
event_pump: event_pump,
event_pump,
vblank_interrupt: false,
stat_interrupt: false,
pixels: pixels,
pixels,
frameskip: 0,
frame_no: 0,

View File

@ -47,7 +47,7 @@ pub fn read_file<P: AsRef<Path>>(rom_path: P) -> Result<Box<[u8]>, io::Error> {
Ok(buf.into_boxed_slice())
}
pub fn write_file<P: AsRef<Path>>(path: P, data: &Box<[u8]>) -> Result<(), io::Error> {
pub fn write_file<P: AsRef<Path>>(path: P, data: &[u8]) -> Result<(), io::Error> {
let mut file = fs::File::create(path)?;
file.write_all(&data)?;
Ok(())