Skip to content

Commit

Permalink
#262: Fix lints for Rust 1.72
Browse files Browse the repository at this point in the history
  • Loading branch information
mtkennerly committed Aug 25, 2023
1 parent 3ebf8cf commit a3b0355
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 13 deletions.
4 changes: 3 additions & 1 deletion src/cloud.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ pub fn validate_cloud_config(config: &Config, cloud_path: &str) -> Result<Remote
if !config.apps.rclone.is_valid() {
return Err(Error::RcloneUnavailable);
}
let Some(remote) = config.cloud.remote.clone() else { return Err(Error::CloudNotConfigured) };
let Some(remote) = config.cloud.remote.clone() else {
return Err(Error::CloudNotConfigured);
};
validate_cloud_path(cloud_path)?;
Ok(remote)
}
Expand Down
8 changes: 6 additions & 2 deletions src/gui/game_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,9 @@ impl GameList {
pub fn set_comment(&mut self, game: &str, comment: String) {
let Some(index) = self.find_game(game) else { return };
let entry = &mut self.entries[index];
let Some(backup) = &mut entry.scan_info.backup else { return };
let Some(backup) = &mut entry.scan_info.backup else {
return;
};
let Some(layout) = &mut entry.game_layout else { return };

layout.set_backup_comment(backup.name(), &comment);
Expand All @@ -738,7 +740,9 @@ impl GameList {
pub fn toggle_locked(&mut self, game: &str) {
let Some(index) = self.find_game(game) else { return };
let entry = &mut self.entries[index];
let Some(backup) = &mut entry.scan_info.backup else { return };
let Some(backup) = &mut entry.scan_info.backup else {
return;
};
let Some(layout) = &mut entry.game_layout else { return };

let new = !backup.locked();
Expand Down
6 changes: 3 additions & 3 deletions src/lang.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ fn set_language(language: Language) {
*last_language = language;
}

static RE_EXTRA_SPACES: Lazy<Regex> = Lazy::new(|| Regex::new(r#"([^\r\n ]) {2,}"#).unwrap());
static RE_EXTRA_LINES: Lazy<Regex> = Lazy::new(|| Regex::new(r#"([^\r\n ])[\r\n]([^\r\n ])"#).unwrap());
static RE_EXTRA_PARAGRAPHS: Lazy<Regex> = Lazy::new(|| Regex::new(r#"([^\r\n ])[\r\n]{2,}([^\r\n ])"#).unwrap());
static RE_EXTRA_SPACES: Lazy<Regex> = Lazy::new(|| Regex::new(r"([^\r\n ]) {2,}").unwrap());
static RE_EXTRA_LINES: Lazy<Regex> = Lazy::new(|| Regex::new(r"([^\r\n ])[\r\n]([^\r\n ])").unwrap());
static RE_EXTRA_PARAGRAPHS: Lazy<Regex> = Lazy::new(|| Regex::new(r"([^\r\n ])[\r\n]{2,}([^\r\n ])").unwrap());

fn translate(id: &str) -> String {
translate_args(id, &FluentArgs::new())
Expand Down
4 changes: 3 additions & 1 deletion src/scan/launchers/generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ pub fn scan(root: &RootsConfig, manifest: &Manifest, subjects: &[String]) -> Has
subjects
.iter()
.filter_map(|name| {
let Some((score, subdir)) = by_title.get(name) else { return None };
let Some((score, subdir)) = by_title.get(name) else {
return None;
};

if *score < i64::MAX {
if let Some(competitors) = by_subdir.get(subdir) {
Expand Down
20 changes: 15 additions & 5 deletions src/scan/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1613,7 +1613,9 @@ impl GameLayout {
if let Err(e) = match &file.container {
None => self.restore_file_from_simple(target, file),
Some(container) => {
let Some(archive) = containers.get_mut(container) else { continue };
let Some(archive) = containers.get_mut(container) else {
continue;
};
self.restore_file_from_zip(target, file, archive)
}
} {
Expand Down Expand Up @@ -1857,8 +1859,12 @@ impl GameLayout {
}
}
BackupFormat::Zip => {
let Ok(handle) = std::fs::File::open(self.path.joined(&backup.name).interpret()) else { return false };
let Ok(mut archive) = zip::ZipArchive::new(handle) else { return false };
let Ok(handle) = std::fs::File::open(self.path.joined(&backup.name).interpret()) else {
return false;
};
let Ok(mut archive) = zip::ZipArchive::new(handle) else {
return false;
};

for file in backup.files.keys() {
let original_path = StrictPath::new(file.to_string());
Expand Down Expand Up @@ -1893,8 +1899,12 @@ impl GameLayout {
}
}
BackupFormat::Zip => {
let Ok(handle) = std::fs::File::open(self.path.joined(&backup.name).interpret()) else { return false };
let Ok(mut archive) = zip::ZipArchive::new(handle) else { return false };
let Ok(handle) = std::fs::File::open(self.path.joined(&backup.name).interpret()) else {
return false;
};
let Ok(mut archive) = zip::ZipArchive::new(handle) else {
return false;
};

for (file, data) in &backup.files {
if data.is_none() {
Expand Down
2 changes: 1 addition & 1 deletion src/scan/title.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ static RE_EDITION_KNOWN: Lazy<Regex> = Lazy::new(|| Regex::new(r#" (game of the
/// This covers any single-word editions that are not separated by punctuation.
/// We can't assume more than one word because it may be part of the main title.
static RE_EDITION_SHORT: Lazy<Regex> = Lazy::new(|| Regex::new(r#" [^ ]+ edition$"#).unwrap());
static RE_YEAR_SUFFIX: Lazy<Regex> = Lazy::new(|| Regex::new(r#" \(\d+\)$"#).unwrap());
static RE_YEAR_SUFFIX: Lazy<Regex> = Lazy::new(|| Regex::new(r" \(\d+\)$").unwrap());
static RE_SYMBOLS: Lazy<Regex> = Lazy::new(|| Regex::new(r#"[™®©:-]"#).unwrap());
static RE_SPACES: Lazy<Regex> = Lazy::new(|| Regex::new(r#" {2,}"#).unwrap());

Expand Down

0 comments on commit a3b0355

Please sign in to comment.