mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-01 13:37:48 +00:00
install: Apply rustfmt
This commit is contained in:
parent
69e8838b27
commit
1a43a94e31
2 changed files with 6 additions and 8 deletions
|
@ -15,9 +15,9 @@ extern crate uucore;
|
||||||
use clap::{crate_version, App, Arg, ArgMatches};
|
use clap::{crate_version, App, Arg, ArgMatches};
|
||||||
use file_diff::diff;
|
use file_diff::diff;
|
||||||
use filetime::{set_file_times, FileTime};
|
use filetime::{set_file_times, FileTime};
|
||||||
|
use uucore::backup_control::{self, BackupMode};
|
||||||
use uucore::entries::{grp2gid, usr2uid};
|
use uucore::entries::{grp2gid, usr2uid};
|
||||||
use uucore::perms::{wrap_chgrp, wrap_chown, Verbosity};
|
use uucore::perms::{wrap_chgrp, wrap_chown, Verbosity};
|
||||||
use uucore::backup_control::{self, BackupMode};
|
|
||||||
|
|
||||||
use libc::{getegid, geteuid};
|
use libc::{getegid, geteuid};
|
||||||
use std::fs;
|
use std::fs;
|
||||||
|
@ -315,8 +315,7 @@ fn behavior(matches: &ArgMatches) -> Result<Behavior, i32> {
|
||||||
matches.is_present(OPT_BACKUP_NO_ARG) || matches.is_present(OPT_BACKUP),
|
matches.is_present(OPT_BACKUP_NO_ARG) || matches.is_present(OPT_BACKUP),
|
||||||
matches.value_of(OPT_BACKUP),
|
matches.value_of(OPT_BACKUP),
|
||||||
),
|
),
|
||||||
suffix: backup_control::determine_backup_suffix(
|
suffix: backup_control::determine_backup_suffix(matches.value_of(OPT_SUFFIX)),
|
||||||
matches.value_of(OPT_SUFFIX)),
|
|
||||||
owner: matches.value_of(OPT_OWNER).unwrap_or("").to_string(),
|
owner: matches.value_of(OPT_OWNER).unwrap_or("").to_string(),
|
||||||
group: matches.value_of(OPT_GROUP).unwrap_or("").to_string(),
|
group: matches.value_of(OPT_GROUP).unwrap_or("").to_string(),
|
||||||
verbose: matches.is_present(OPT_VERBOSE),
|
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
|
// 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)
|
// on how best to approach the issue. (mv and ln, for example)
|
||||||
if to.exists() {
|
if to.exists() {
|
||||||
backup_path = backup_control::get_backup_path(
|
backup_path = backup_control::get_backup_path(b.backup_mode, to, &b.suffix);
|
||||||
b.backup_mode, to, &b.suffix);
|
|
||||||
if let Some(ref backup_path) = backup_path {
|
if let Some(ref backup_path) = backup_path {
|
||||||
// TODO!!
|
// TODO!!
|
||||||
if let Err(err) = fs::rename(to, backup_path) {
|
if let Err(err) = fs::rename(to, backup_path) {
|
||||||
|
|
|
@ -38,17 +38,17 @@ pub fn determine_backup_suffix(supplied_suffix: Option<&str>) -> String {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// # TODO
|
/// # TODO
|
||||||
///
|
///
|
||||||
/// This function currently deviates slightly from how the [manual][1] describes
|
/// This function currently deviates slightly from how the [manual][1] describes
|
||||||
/// that it should work. In particular, the current implementation:
|
/// that it should work. In particular, the current implementation:
|
||||||
///
|
///
|
||||||
/// 1. Doesn't strictly respect the order in which to determine the backup type,
|
/// 1. Doesn't strictly respect the order in which to determine the backup type,
|
||||||
/// which is (in order of precedence)
|
/// which is (in order of precedence)
|
||||||
/// 1. Take a valid value to the '--backup' option
|
/// 1. Take a valid value to the '--backup' option
|
||||||
/// 2. Take the value of the `VERSION_CONTROL` env var
|
/// 2. Take the value of the `VERSION_CONTROL` env var
|
||||||
/// 3. default to 'existing'
|
/// 3. default to 'existing'
|
||||||
/// 2. Doesn't accept abbreviations to the 'backup_option' parameter
|
/// 2. Doesn't accept abbreviations to the 'backup_option' parameter
|
||||||
///
|
///
|
||||||
/// [1]: https://www.gnu.org/software/coreutils/manual/html_node/Backup-options.html
|
/// [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 {
|
pub fn determine_backup_mode(backup_opt_exists: bool, backup_opt: Option<&str>) -> BackupMode {
|
||||||
if backup_opt_exists {
|
if backup_opt_exists {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue