From e0d16ca4aa6aafad8caebd648c242ac32c2cdae4 Mon Sep 17 00:00:00 2001 From: mtkennerly Date: Thu, 22 Dec 2022 05:12:02 +0800 Subject: [PATCH] Update for Rust 1.66.0 --- src/config.rs | 4 ++-- src/layout.rs | 6 +++--- src/path.rs | 6 +++--- src/prelude.rs | 2 +- src/registry.rs | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/config.rs b/src/config.rs index 222cb12c..71f482ce 100644 --- a/src/config.rs +++ b/src/config.rs @@ -514,7 +514,7 @@ impl Config { } pub fn archive_invalid() -> Result<(), Box> { - std::fs::rename(&Self::path(), &Self::file_archived_invalid())?; + std::fs::rename(Self::path(), Self::file_archived_invalid())?; Ok(()) } @@ -603,7 +603,7 @@ impl Config { let mut install_dirs = vec![]; let manifest_dir = subkey.get_value::("ModSdkMetadataDir")?; - for entry in std::fs::read_dir(&manifest_dir)?.flatten() { + for entry in std::fs::read_dir(manifest_dir)?.flatten() { if !entry.file_type()?.is_file() { continue; } diff --git a/src/layout.rs b/src/layout.rs index 2f28085c..81f2c20c 100644 --- a/src/layout.rs +++ b/src/layout.rs @@ -719,7 +719,7 @@ impl GameLayout { match format { BackupFormat::Simple => self.path.joined(backup).joined("registry.yaml").read(), BackupFormat::Zip => { - let handle = std::fs::File::open(&self.path.joined(backup).interpret()).ok()?; + let handle = std::fs::File::open(self.path.joined(backup).interpret()).ok()?; let mut archive = zip::ZipArchive::new(handle).ok()?; let mut file = archive.by_name("registry.yaml").ok()?; @@ -1371,7 +1371,7 @@ impl GameLayout { target.raw() ); - let handle = std::fs::File::open(&container.interpret())?; + let handle = std::fs::File::open(container.interpret())?; let mut archive = zip::ZipArchive::new(handle)?; if target.exists() && target.try_same_content_as_zip(&mut archive.by_name(&file.path.raw())?)? { @@ -1399,7 +1399,7 @@ impl GameLayout { ); continue; } - let mut target_handle = match std::fs::File::create(&target.interpret()) { + let mut target_handle = match std::fs::File::create(target.interpret()) { Ok(x) => x, Err(e) => { log::warn!( diff --git a/src/path.rs b/src/path.rs index 27ad306f..41a8bba9 100644 --- a/src/path.rs +++ b/src/path.rs @@ -346,9 +346,9 @@ impl StrictPath { pub fn remove(&self) -> Result<(), Box> { if self.is_file() { - std::fs::remove_file(&self.interpret())?; + std::fs::remove_file(self.interpret())?; } else if self.is_dir() { - std::fs::remove_dir_all(&self.interpret())?; + std::fs::remove_dir_all(self.interpret())?; } Ok(()) } @@ -389,7 +389,7 @@ impl StrictPath { std::io::ErrorKind::Other, "Failed to unset read-only", )); - } else if let Err(e) = std::fs::copy(&self.interpret(), &target_file.interpret()) { + } else if let Err(e) = std::fs::copy(self.interpret(), target_file.interpret()) { log::error!( "[{context}] try {attempt}, unable to copy: {} -> {} | {e}", self.raw(), diff --git a/src/prelude.rs b/src/prelude.rs index 67cc5045..9b137ae5 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -1258,7 +1258,7 @@ pub fn prepare_backup_target(target: &StrictPath, merge: bool) -> Result<(), Err } let p = target.as_std_path_buf(); - std::fs::create_dir_all(&p).map_err(|_| Error::CannotPrepareBackupTarget { path: target.clone() })?; + std::fs::create_dir_all(p).map_err(|_| Error::CannotPrepareBackupTarget { path: target.clone() })?; Ok(()) } diff --git a/src/registry.rs b/src/registry.rs index c8b3e7fd..edb2b4e3 100644 --- a/src/registry.rs +++ b/src/registry.rs @@ -124,7 +124,7 @@ fn read_registry_key(key: &winreg::RegKey) -> Entries { impl Hives { pub fn load(file: &StrictPath) -> Option { if file.is_file() { - let content = std::fs::read_to_string(&file.interpret()).ok()?; + let content = std::fs::read_to_string(file.interpret()).ok()?; Self::deserialize(&content) } else { None