mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-30 20:47:46 +00:00
fix clippy in cp
This commit is contained in:
parent
97d12d6e3c
commit
75a76613e4
1 changed files with 8 additions and 6 deletions
|
@ -132,7 +132,9 @@ macro_rules! prompt_yes(
|
|||
|
||||
pub type CopyResult<T> = Result<T, Error>;
|
||||
pub type Source = PathBuf;
|
||||
pub type SourceSlice = Path;
|
||||
pub type Target = PathBuf;
|
||||
pub type TargetSlice = Path;
|
||||
|
||||
/// Specifies whether when overwrite files
|
||||
#[derive(Clone, Eq, PartialEq)]
|
||||
|
@ -664,7 +666,7 @@ impl TargetType {
|
|||
///
|
||||
/// Treat target as a dir if we have multiple sources or the target
|
||||
/// exists and already is a directory
|
||||
fn determine(sources: &[Source], target: &Target) -> TargetType {
|
||||
fn determine(sources: &[Source], target: &TargetSlice) -> TargetType {
|
||||
if sources.len() > 1 || target.is_dir() {
|
||||
TargetType::Directory
|
||||
} else {
|
||||
|
@ -787,7 +789,7 @@ fn preserve_hardlinks(
|
|||
/// Behavior depends on `options`, see [`Options`] for details.
|
||||
///
|
||||
/// [`Options`]: ./struct.Options.html
|
||||
fn copy(sources: &[Source], target: &Target, options: &Options) -> CopyResult<()> {
|
||||
fn copy(sources: &[Source], target: &TargetSlice, options: &Options) -> CopyResult<()> {
|
||||
let target_type = TargetType::determine(sources, target);
|
||||
verify_target_type(target, &target_type)?;
|
||||
|
||||
|
@ -839,7 +841,7 @@ fn copy(sources: &[Source], target: &Target, options: &Options) -> CopyResult<()
|
|||
|
||||
fn construct_dest_path(
|
||||
source_path: &Path,
|
||||
target: &Target,
|
||||
target: &TargetSlice,
|
||||
target_type: &TargetType,
|
||||
options: &Options,
|
||||
) -> CopyResult<PathBuf> {
|
||||
|
@ -869,8 +871,8 @@ fn construct_dest_path(
|
|||
}
|
||||
|
||||
fn copy_source(
|
||||
source: &Source,
|
||||
target: &Target,
|
||||
source: &SourceSlice,
|
||||
target: &TargetSlice,
|
||||
target_type: &TargetType,
|
||||
options: &Options,
|
||||
) -> CopyResult<()> {
|
||||
|
@ -911,7 +913,7 @@ fn adjust_canonicalization(p: &Path) -> Cow<Path> {
|
|||
///
|
||||
/// Any errors encountered copying files in the tree will be logged but
|
||||
/// will not cause a short-circuit.
|
||||
fn copy_directory(root: &Path, target: &Target, options: &Options) -> CopyResult<()> {
|
||||
fn copy_directory(root: &Path, target: &TargetSlice, options: &Options) -> CopyResult<()> {
|
||||
if !options.recursive {
|
||||
return Err(format!("omitting directory '{}'", root.display()).into());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue