Skip to content

Commit

Permalink
Misc: Make clippy happy
Browse files Browse the repository at this point in the history
  • Loading branch information
AlessioC31 authored and guerinoni committed Feb 18, 2024
1 parent fea8366 commit b020dc6
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions ui/src/savegame.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::{
error::Error,
io::{Read, Write},
path::PathBuf,
sync::{Arc, Mutex},
};

Expand All @@ -21,17 +20,13 @@ impl SaveGame {
Self { gba }
}

fn check_pathbuf(path: Option<PathBuf>) -> Result<PathBuf, &'static str> {
path.map_or(Err("No file selected"), Ok)
}

fn save_state(&self) -> Result<(), Box<dyn Error>> {
let path = FileDialog::new()
.set_location("~")
.add_filter("Clementine save file", &["clm"])
.show_save_single_file()?;

let path = Self::check_pathbuf(path)?;
let path = path.ok_or("No file selected")?;

let cpu = &self.gba.lock().unwrap().cpu;

Expand All @@ -49,7 +44,7 @@ impl SaveGame {
.add_filter("Clementine save file", &["clm"])
.show_open_single_file()?;

let path = Self::check_pathbuf(path)?;
let path = path.ok_or("No file selected")?;

let mut file = fs::OpenOptions::new().read(true).open(path)?;
let mut encoded = Vec::new();
Expand Down

0 comments on commit b020dc6

Please sign in to comment.