Skip to content

Commit

Permalink
clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
selassje committed Oct 13, 2023
1 parent 174902a commit 05dd625
Show file tree
Hide file tree
Showing 9 changed files with 275 additions and 281 deletions.
2 changes: 1 addition & 1 deletion src/apu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ impl PulseWave {

fn get_sample(&self) -> u8 {
DUTY_CYCLE_SEQUENCES[self.get_duty_cycle() as usize][self.sequencer_position as usize]
* self.get_volume() as u8
* self.get_volume()
}

fn get_volume(&self) -> u8 {
Expand Down
2 changes: 1 addition & 1 deletion src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl<T> Default for NonNullPtr<T> {

impl<T> Clone for NonNullPtr<T> {
fn clone(&self) -> Self {
Self(self.0)
*self
}
}

Expand Down
7 changes: 1 addition & 6 deletions src/cpu/opcodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,7 @@ pub(super) struct OpCode<RAM: Memory, PPU: PpuState, APU: ApuState> {

impl<RAM: Memory, PPU: PpuState, APU: ApuState> Clone for OpCode<RAM, PPU, APU> {
fn clone(&self) -> Self {
Self {
instruction: self.instruction,
mode: self.mode,
base_cycles: self.base_cycles,
extra_cycle_on_page_crossing: self.extra_cycle_on_page_crossing,
}
*self
}
}
impl<RAM: Memory, PPU: PpuState, APU: ApuState> Copy for OpCode<RAM, PPU, APU> {}
Expand Down
4 changes: 2 additions & 2 deletions src/io/io_sdl2_imgui_opengl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ impl IOSdl2ImGuiOpenGl {
}
let [video_width, video_height]: [u32; 2] = gui::VideoSizeControl::Double.into();
let mut window = video_subsys
.window("NES-RS", video_width, MENU_BAR_HEIGHT as u32 + video_height)
.window("NES-RS", video_width, MENU_BAR_HEIGHT + video_height)
.position_centered()
.opengl()
.build()
Expand Down Expand Up @@ -298,7 +298,7 @@ impl IOSdl2ImGuiOpenGl {
.borrow_mut()
.set_size(
std::cmp::max(video_width, MIN_WINDOW_WIDTH),
video_height + MENU_BAR_HEIGHT as u32,
video_height + MENU_BAR_HEIGHT,
)
.unwrap();
[video_width as f32, video_height as f32]
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl Emulation {
let one_second_timer = std::time::Instant::now();

let io_control = io::IOControl {
target_fps: common::DEFAULT_FPS as u16,
target_fps: common::DEFAULT_FPS,
current_fps: 0,
title: initial_title,
};
Expand Down Expand Up @@ -125,7 +125,7 @@ impl emscripten_main_loop::MainLoop for Emulation {

fn read_nes_file(file_name: &str) -> nes_file::NesFile {
let mut rom = Vec::new();
let mut file = File::open(&file_name).unwrap_or_else(|_| {
let mut file = File::open(file_name).unwrap_or_else(|_| {
panic!(
"Unable to open ROM {} current dir {}",
file_name,
Expand Down
2 changes: 1 addition & 1 deletion src/mappers/mapper7.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl Mapper for Mapper7 {

fn get_prg_byte(&mut self, address: u16) -> u8 {
if address >= 0x8000 {
let bank = (self.register & 7) as usize;
let bank = self.register & 7;
self.mapper_internal.get_prg_rom_byte(address, bank, _32KB)
} else {
0
Expand Down
Loading

0 comments on commit 05dd625

Please sign in to comment.