Implement simple clippy suggestions (#159)

This commit is contained in:
Philip Kristoffersen
2022-05-27 13:19:10 +02:00
committed by GitHub
parent c57a7ec4a2
commit 835c7ead8d
12 changed files with 79 additions and 97 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ pub(crate) struct Game {
impl From<Game> for ShortcutOwned {
fn from(game: Game) -> Self {
let launch = format!("\"uplay://launch/{}/0\"", game.id);
let start_dir = game.launcher.parent().unwrap_or(Path::new("")).to_string_lossy();
let start_dir = game.launcher.parent().unwrap_or_else(|| {Path::new("")}).to_string_lossy();
let exe = format!("\"{}\"",game.launcher.to_string_lossy());
Shortcut::new("0", &game.name, &exe, &start_dir, &game.icon, "", &launch).to_owned()
}
+6 -6
View File
@@ -29,18 +29,18 @@ impl Platform<Game, Box<dyn Error>> for Uplay {
#[cfg(target_family = "unix")]
{
//Linux not supported yet
return crate::platform::SettingsValidity::Invalid {
crate::platform::SettingsValidity::Invalid {
reason: "Linux not supported yet".to_string(),
};
}
}
#[cfg(target_os = "windows")]
{
if get_launcher_path().is_some() {
return crate::platform::SettingsValidity::Valid;
crate::platform::SettingsValidity::Valid
} else {
return crate::platform::SettingsValidity::Invalid {
crate::platform::SettingsValidity::Invalid {
reason: "Could not find UPlay instalation".to_string(),
};
}
}
}
}
@@ -82,7 +82,7 @@ fn get_launcher_path() -> Option<PathBuf> {
if let Ok(launcher_dir) = launcher_dir {
let path = Path::new(&launcher_dir).join("upc.exe");
if path.exists() {
return Some(path.to_path_buf());
return Some(path);
}
}
}