Minor refactors based on cargo clippy

This commit is contained in:
Philip Kristoffersen
2022-08-15 15:32:12 +02:00
parent 07d2551c63
commit 6749a3db00
8 changed files with 20 additions and 18 deletions
+2 -2
View File
@@ -27,7 +27,7 @@ pub(crate) fn get_egs_manifests(
manifest.manifest_location = compat_folder
.join("pfx")
.join("drive_c")
.join(&manifest.manifest_location[3..].replace("\\", "/"))
.join(&manifest.manifest_location[3..].replace('\\', "/"))
.to_path_buf()
.to_string_lossy()
.to_string();
@@ -35,7 +35,7 @@ pub(crate) fn get_egs_manifests(
manifest.install_location = compat_folder
.join("pfx")
.join("drive_c")
.join(&manifest.install_location[3..].replace("\\", "/"))
.join(&manifest.install_location[3..].replace('\\', "/"))
.to_path_buf()
.to_string_lossy()
.to_string();
+1 -1
View File
@@ -68,7 +68,7 @@ mod unix {
//We found all we need
return Some(EpicPaths {
launcher_path,
compat_folder_path: Some(dir.path().to_path_buf()),
compat_folder_path: Some(dir.path()),
manifest_folder_path,
});
}
+1 -1
View File
@@ -44,7 +44,7 @@ impl Platform<FlatpakApp, Box<dyn Error>> for FlatpakPlatform {
let output_string = String::from_utf8_lossy(&output.stdout).to_string();
let mut result = vec![];
for line in output_string.lines() {
let mut split = line.split("\t");
let mut split = line.split('\t');
if let Some(name) = split.next() {
if let Some(id) = split.next() {
result.push(FlatpakApp {
+1 -1
View File
@@ -174,7 +174,7 @@ impl Platform<GogShortcut, String> for GogPlatform {
match shortcuts_res {
Ok(_) => SettingsValidity::Valid,
Err(err) => SettingsValidity::Invalid {
reason: format!("{}", err),
reason: err.to_string(),
},
}
}
+1 -1
View File
@@ -25,7 +25,7 @@ impl HeroicGameType {
title,
app_name,
install_mode,
} => &app_name,
} => app_name,
}
}
+1 -1
View File
@@ -63,7 +63,7 @@ impl Platform<ItchGame, String> for ItchPlatform {
match shortcuts_res {
Ok(_) => SettingsValidity::Valid,
Err(err) => SettingsValidity::Invalid {
reason: format!("{}", err),
reason: err.to_string(),
},
}
}
+11 -9
View File
@@ -1,14 +1,10 @@
use super::lutris_game::LutrisGame;
pub fn parse_lutris_games(input: &str) -> Vec<LutrisGame> {
let games = serde_json::from_str::<Vec<LutrisGame>>(&input);
let games = serde_json::from_str::<Vec<LutrisGame>>(input);
match games {
Ok(games) => {
return games
}
Err(_err) => {
return Vec::new()
}
Ok(games) => games,
Err(_err) => Vec::new(),
}
}
@@ -40,7 +36,10 @@ mod tests {
let games = parse_lutris_games(content);
assert_eq!(games[5].name, "The Witcher 3: Wild Hunt - Game of the Year Edition");
assert_eq!(
games[5].name,
"The Witcher 3: Wild Hunt - Game of the Year Edition"
);
}
#[test]
@@ -49,7 +48,10 @@ mod tests {
let games = parse_lutris_games(content);
assert_eq!(games[5].slug, "the-witcher-3-wild-hunt-game-of-the-year-edition");
assert_eq!(
games[5].slug,
"the-witcher-3-wild-hunt-game-of-the-year-edition"
);
}
#[test]
+2 -2
View File
@@ -66,7 +66,7 @@ impl Platform<OriginGame, String> for OriginPlatform {
match shortcuts_res {
Ok(_) => SettingsValidity::Valid,
Err(err) => SettingsValidity::Invalid {
reason: format!("{}", err),
reason: err.to_string(),
},
}
}
@@ -150,7 +150,7 @@ fn get_default_locations() -> Option<OriginPathData> {
if origin_exe_path.exists() && origin_local_content.exists() {
res.exe_path = origin_exe_path;
res.local_content_path = origin_local_content;
res.compat_folder = Some(dir.path().to_path_buf());
res.compat_folder = Some(dir.path());
return Some(res);
}
}