Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 64d308d

Browse filesBrowse files
cakebakersylvestre
authored andcommitted
install: use map_err instead of if let Err
1 parent 74d04c2 commit 64d308d
Copy full SHA for 64d308d

File tree

Expand file treeCollapse file tree

1 file changed

+3
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-5
lines changed

‎src/uu/install/src/install.rs

Copy file name to clipboardExpand all lines: src/uu/install/src/install.rs
+3-5Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -730,11 +730,9 @@ fn perform_backup(to: &Path, b: &Behavior) -> UResult<Option<PathBuf>> {
730730
}
731731
let backup_path = backup_control::get_backup_path(b.backup_mode, to, &b.suffix);
732732
if let Some(ref backup_path) = backup_path {
733-
if let Err(err) = fs::rename(to, backup_path) {
734-
return Err(
735-
InstallError::BackupFailed(to.to_path_buf(), backup_path.clone(), err).into(),
736-
);
737-
}
733+
fs::rename(to, backup_path).map_err(|err| {
734+
InstallError::BackupFailed(to.to_path_buf(), backup_path.clone(), err)
735+
})?;
738736
}
739737
Ok(backup_path)
740738
} else {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.