Skip to content

Commit

Permalink
Update for Rust 1.66.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mtkennerly committed Dec 21, 2022
1 parent 284c0a9 commit e0d16ca
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ impl Config {
}

pub fn archive_invalid() -> Result<(), Box<dyn std::error::Error>> {
std::fs::rename(&Self::path(), &Self::file_archived_invalid())?;
std::fs::rename(Self::path(), Self::file_archived_invalid())?;
Ok(())
}

Expand Down Expand Up @@ -603,7 +603,7 @@ impl Config {

let mut install_dirs = vec![];
let manifest_dir = subkey.get_value::<String, &str>("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;
}
Expand Down
6 changes: 3 additions & 3 deletions src/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()?;

Expand Down Expand Up @@ -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())?)? {
Expand Down Expand Up @@ -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!(
Expand Down
6 changes: 3 additions & 3 deletions src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,9 @@ impl StrictPath {

pub fn remove(&self) -> Result<(), Box<dyn std::error::Error>> {
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(())
}
Expand Down Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}
Expand Down
2 changes: 1 addition & 1 deletion src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ fn read_registry_key(key: &winreg::RegKey) -> Entries {
impl Hives {
pub fn load(file: &StrictPath) -> Option<Self> {
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
Expand Down

0 comments on commit e0d16ca

Please sign in to comment.