From 1a43a94e3147b2187cd4f37f350d218c2607aacf Mon Sep 17 00:00:00 2001 From: Andreas Hartmann Date: Sun, 27 Jun 2021 09:16:16 +0200 Subject: [PATCH] install: Apply rustfmt --- src/uu/install/src/install.rs | 8 +++----- src/uucore/src/lib/mods/backup_control.rs | 6 +++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index d25fc47bc..3b1384d8a 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -15,9 +15,9 @@ extern crate uucore; use clap::{crate_version, App, Arg, ArgMatches}; use file_diff::diff; use filetime::{set_file_times, FileTime}; +use uucore::backup_control::{self, BackupMode}; use uucore::entries::{grp2gid, usr2uid}; use uucore::perms::{wrap_chgrp, wrap_chown, Verbosity}; -use uucore::backup_control::{self, BackupMode}; use libc::{getegid, geteuid}; use std::fs; @@ -315,8 +315,7 @@ fn behavior(matches: &ArgMatches) -> Result { matches.is_present(OPT_BACKUP_NO_ARG) || matches.is_present(OPT_BACKUP), matches.value_of(OPT_BACKUP), ), - suffix: backup_control::determine_backup_suffix( - matches.value_of(OPT_SUFFIX)), + suffix: backup_control::determine_backup_suffix(matches.value_of(OPT_SUFFIX)), owner: matches.value_of(OPT_OWNER).unwrap_or("").to_string(), group: matches.value_of(OPT_GROUP).unwrap_or("").to_string(), verbose: matches.is_present(OPT_VERBOSE), @@ -521,8 +520,7 @@ fn copy(from: &Path, to: &Path, b: &Behavior) -> Result<(), ()> { // The codes actually making use of the backup process don't seem to agree // on how best to approach the issue. (mv and ln, for example) if to.exists() { - backup_path = backup_control::get_backup_path( - b.backup_mode, to, &b.suffix); + backup_path = backup_control::get_backup_path(b.backup_mode, to, &b.suffix); if let Some(ref backup_path) = backup_path { // TODO!! if let Err(err) = fs::rename(to, backup_path) { diff --git a/src/uucore/src/lib/mods/backup_control.rs b/src/uucore/src/lib/mods/backup_control.rs index bbe9cd227..b8f389c83 100644 --- a/src/uucore/src/lib/mods/backup_control.rs +++ b/src/uucore/src/lib/mods/backup_control.rs @@ -38,17 +38,17 @@ pub fn determine_backup_suffix(supplied_suffix: Option<&str>) -> String { } /// # TODO -/// +/// /// This function currently deviates slightly from how the [manual][1] describes /// that it should work. In particular, the current implementation: -/// +/// /// 1. Doesn't strictly respect the order in which to determine the backup type, /// which is (in order of precedence) /// 1. Take a valid value to the '--backup' option /// 2. Take the value of the `VERSION_CONTROL` env var /// 3. default to 'existing' /// 2. Doesn't accept abbreviations to the 'backup_option' parameter -/// +/// /// [1]: https://www.gnu.org/software/coreutils/manual/html_node/Backup-options.html pub fn determine_backup_mode(backup_opt_exists: bool, backup_opt: Option<&str>) -> BackupMode { if backup_opt_exists {