refactor: clippy autofix
Former-commit-id: da7665869588cdb52e96ceeb2edcb7e7c13a4d44 Former-commit-id: 785d0e54cf09f781feecffd6512f3353d6b150e5
This commit is contained in:
parent
5a03546a7c
commit
4179b0ec28
|
@ -1,4 +1,3 @@
|
|||
use sdl2;
|
||||
use sdl2::audio::{AudioCallback, AudioDevice, AudioFormat, AudioSpec, AudioSpecDesired};
|
||||
|
||||
use rustboyadvance_core::prelude::SimpleAudioInterface;
|
||||
|
|
|
@ -4,7 +4,6 @@ use sdl2::keyboard::Scancode;
|
|||
|
||||
use rustboyadvance_core::keypad as gba_keypad;
|
||||
|
||||
use bit;
|
||||
use bit::BitIndex;
|
||||
|
||||
pub fn on_keyboard_key_down(key_state: &mut u16, scancode: Scancode) {
|
||||
|
|
|
@ -3,8 +3,6 @@ use sdl2::event::Event;
|
|||
use sdl2::keyboard::Scancode;
|
||||
use sdl2::{self};
|
||||
|
||||
use bytesize;
|
||||
use spin_sleep;
|
||||
use structopt::StructOpt;
|
||||
|
||||
use std::fs;
|
||||
|
@ -14,7 +12,6 @@ use std::time;
|
|||
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
use flexi_logger;
|
||||
use flexi_logger::*;
|
||||
|
||||
mod audio;
|
||||
|
@ -29,7 +26,7 @@ use rustboyadvance_utils::FpsCounter;
|
|||
const LOG_DIR: &str = ".logs";
|
||||
|
||||
fn ask_download_bios() {
|
||||
const OPEN_SOURCE_BIOS_URL: &'static str =
|
||||
const OPEN_SOURCE_BIOS_URL: &str =
|
||||
"https://github.com/Nebuleon/ReGBA/raw/master/bios/gba_bios.bin";
|
||||
println!("Missing BIOS file. If you don't have the original GBA BIOS, you can download an open-source bios from {}", OPEN_SOURCE_BIOS_URL);
|
||||
std::process::exit(0);
|
||||
|
@ -46,7 +43,7 @@ fn load_bios(bios_path: &Path) -> Box<[u8]> {
|
|||
}
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
fs::create_dir_all(LOG_DIR).expect(&format!("could not create log directory ({})", LOG_DIR));
|
||||
fs::create_dir_all(LOG_DIR).unwrap_or_else(|_| panic!("could not create log directory ({})", LOG_DIR));
|
||||
flexi_logger::Logger::with_env_or_str("info")
|
||||
.log_to_file()
|
||||
.directory(LOG_DIR)
|
||||
|
@ -84,7 +81,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
|
||||
let mut renderer = video::init(&sdl_context)?;
|
||||
let (audio_interface, mut _sdl_audio_device) = audio::create_audio_player(&sdl_context)?;
|
||||
let mut rom_name = opts.rom_name();
|
||||
let rom_name = opts.rom_name();
|
||||
|
||||
let bios_bin = load_bios(&opts.bios);
|
||||
|
||||
|
@ -194,9 +191,9 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
};
|
||||
if removed {
|
||||
let name = active_controller
|
||||
.and_then(|controller| Some(controller.name()))
|
||||
.map(|controller| Some(controller.name()))
|
||||
.unwrap();
|
||||
info!("Removing game controller: {}", name);
|
||||
info!("Removing game controller: {:?}", name);
|
||||
active_controller = None;
|
||||
}
|
||||
}
|
||||
|
@ -208,7 +205,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
}
|
||||
}
|
||||
Event::Quit { .. } => break 'running,
|
||||
Event::DropFile { filename, .. } => {
|
||||
Event::DropFile { .. } => {
|
||||
todo!("impl DropFile again")
|
||||
}
|
||||
_ => {}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use std::{io, path::PathBuf};
|
||||
use std::{path::PathBuf};
|
||||
|
||||
use rustboyadvance_core::{
|
||||
cartridge::{BackupType, GamepakBuilder},
|
||||
|
|
|
@ -22,7 +22,7 @@ pub struct Renderer<'a> {
|
|||
image_context: Sdl2ImageContext,
|
||||
}
|
||||
|
||||
pub fn init<'a>(sdl_context: &'a Sdl) -> Result<Renderer<'a>, Box<dyn std::error::Error>> {
|
||||
pub fn init(sdl_context: &Sdl) -> Result<Renderer<'_>, Box<dyn std::error::Error>> {
|
||||
let video_subsystem = sdl_context.video()?;
|
||||
let image_context = sdl2::image::init(InitFlag::PNG | InitFlag::JPG)?;
|
||||
let mut window = video_subsystem
|
||||
|
@ -57,7 +57,7 @@ pub fn init<'a>(sdl_context: &'a Sdl) -> Result<Renderer<'a>, Box<dyn std::error
|
|||
|
||||
impl<'a> Renderer<'a> {
|
||||
pub fn set_window_title(&mut self, title: &str) {
|
||||
self.canvas.window_mut().set_title(&title).unwrap();
|
||||
self.canvas.window_mut().set_title(title).unwrap();
|
||||
}
|
||||
|
||||
pub fn render(&mut self, buffer: &[u32]) {
|
||||
|
|
Reference in a new issue