From a3b0355c6bd05058c7afcd087d84ba60427c3434 Mon Sep 17 00:00:00 2001 From: mtkennerly Date: Fri, 25 Aug 2023 15:49:38 +0800 Subject: [PATCH] #262: Fix lints for Rust 1.72 --- src/cloud.rs | 4 +++- src/gui/game_list.rs | 8 ++++++-- src/lang.rs | 6 +++--- src/scan/launchers/generic.rs | 4 +++- src/scan/layout.rs | 20 +++++++++++++++----- src/scan/title.rs | 2 +- 6 files changed, 31 insertions(+), 13 deletions(-) diff --git a/src/cloud.rs b/src/cloud.rs index a8983082..78d58c56 100644 --- a/src/cloud.rs +++ b/src/cloud.rs @@ -11,7 +11,9 @@ pub fn validate_cloud_config(config: &Config, cloud_path: &str) -> Result = Lazy::new(|| Regex::new(r#"([^\r\n ]) {2,}"#).unwrap()); -static RE_EXTRA_LINES: Lazy = Lazy::new(|| Regex::new(r#"([^\r\n ])[\r\n]([^\r\n ])"#).unwrap()); -static RE_EXTRA_PARAGRAPHS: Lazy = Lazy::new(|| Regex::new(r#"([^\r\n ])[\r\n]{2,}([^\r\n ])"#).unwrap()); +static RE_EXTRA_SPACES: Lazy = Lazy::new(|| Regex::new(r"([^\r\n ]) {2,}").unwrap()); +static RE_EXTRA_LINES: Lazy = Lazy::new(|| Regex::new(r"([^\r\n ])[\r\n]([^\r\n ])").unwrap()); +static RE_EXTRA_PARAGRAPHS: Lazy = Lazy::new(|| Regex::new(r"([^\r\n ])[\r\n]{2,}([^\r\n ])").unwrap()); fn translate(id: &str) -> String { translate_args(id, &FluentArgs::new()) diff --git a/src/scan/launchers/generic.rs b/src/scan/launchers/generic.rs index 352c0ec2..7986e592 100644 --- a/src/scan/launchers/generic.rs +++ b/src/scan/launchers/generic.rs @@ -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) { diff --git a/src/scan/layout.rs b/src/scan/layout.rs index a14595d8..e58b4637 100644 --- a/src/scan/layout.rs +++ b/src/scan/layout.rs @@ -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) } } { @@ -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()); @@ -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() { diff --git a/src/scan/title.rs b/src/scan/title.rs index 7c2f4e43..0d004e10 100644 --- a/src/scan/title.rs +++ b/src/scan/title.rs @@ -15,7 +15,7 @@ static RE_EDITION_KNOWN: Lazy = 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 = Lazy::new(|| Regex::new(r#" [^ ]+ edition$"#).unwrap()); -static RE_YEAR_SUFFIX: Lazy = Lazy::new(|| Regex::new(r#" \(\d+\)$"#).unwrap()); +static RE_YEAR_SUFFIX: Lazy = Lazy::new(|| Regex::new(r" \(\d+\)$").unwrap()); static RE_SYMBOLS: Lazy = Lazy::new(|| Regex::new(r#"[™®©:-]"#).unwrap()); static RE_SPACES: Lazy = Lazy::new(|| Regex::new(r#" {2,}"#).unwrap());