mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-06 19:45:29 +00:00
Clippy lints
This commit is contained in:
parent
c83b38a874
commit
5b37a117f1
@ -35,11 +35,11 @@ impl TarDecompressor {
|
|||||||
let mut file = file?;
|
let mut file = file?;
|
||||||
|
|
||||||
let file_path = PathBuf::from(into).join(file.path()?);
|
let file_path = PathBuf::from(into).join(file.path()?);
|
||||||
if file_path.exists() {
|
if file_path.exists()
|
||||||
if !utils::permission_for_overwriting(&file_path, flags, &confirm)? {
|
&& !utils::permission_for_overwriting(&file_path, flags, &confirm)?
|
||||||
// The user does not want to overwrite the file
|
{
|
||||||
continue;
|
// The user does not want to overwrite the file
|
||||||
}
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
file.unpack_in(into)?;
|
file.unpack_in(into)?;
|
||||||
|
@ -11,7 +11,7 @@ use super::decompressor::{DecompressionResult, Decompressor};
|
|||||||
use crate::{cli::Flags, dialogs::Confirmation, file::File, utils};
|
use crate::{cli::Flags, dialogs::Confirmation, file::File, utils};
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
fn __unix_set_permissions(file_path: &PathBuf, file: &ZipFile) {
|
fn __unix_set_permissions(file_path: &Path, file: &ZipFile) {
|
||||||
use std::os::unix::fs::PermissionsExt;
|
use std::os::unix::fs::PermissionsExt;
|
||||||
|
|
||||||
if let Some(mode) = file.unix_mode() {
|
if let Some(mode) = file.unix_mode() {
|
||||||
@ -52,11 +52,11 @@ impl ZipDecompressor {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let file_path = into.join(file_path);
|
let file_path = into.join(file_path);
|
||||||
if file_path.exists() {
|
if file_path.exists()
|
||||||
if !utils::permission_for_overwriting(&file_path, flags, &confirm)? {
|
&& !utils::permission_for_overwriting(&file_path, flags, &confirm)?
|
||||||
// The user does not want to overwrite the file
|
{
|
||||||
continue;
|
// The user does not want to overwrite the file
|
||||||
}
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Self::check_for_comments(&file);
|
Self::check_for_comments(&file);
|
||||||
|
@ -162,11 +162,11 @@ impl Evaluator {
|
|||||||
|
|
||||||
// TODO: use -y and -n here
|
// TODO: use -y and -n here
|
||||||
let output_path = output.path.clone();
|
let output_path = output.path.clone();
|
||||||
if output_path.exists() {
|
if output_path.exists()
|
||||||
if !utils::permission_for_overwriting(&output_path, flags, &confirm)? {
|
&& !utils::permission_for_overwriting(&output_path, flags, &confirm)?
|
||||||
// The user does not want to overwrite the file
|
{
|
||||||
return Ok(());
|
// The user does not want to overwrite the file
|
||||||
}
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
let bytes = match first_compressor {
|
let bytes = match first_compressor {
|
||||||
|
@ -59,7 +59,7 @@ pub(crate) fn get_destination_path(dest: &Option<File>) -> &Path {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn change_dir_and_return_parent(filename: &PathBuf) -> crate::Result<PathBuf> {
|
pub(crate) fn change_dir_and_return_parent(filename: &Path) -> crate::Result<PathBuf> {
|
||||||
let previous_location = env::current_dir()?;
|
let previous_location = env::current_dir()?;
|
||||||
|
|
||||||
let parent = if let Some(parent) = filename.parent() {
|
let parent = if let Some(parent) = filename.parent() {
|
||||||
@ -73,7 +73,7 @@ pub(crate) fn change_dir_and_return_parent(filename: &PathBuf) -> crate::Result<
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn permission_for_overwriting(
|
pub fn permission_for_overwriting(
|
||||||
path: &PathBuf,
|
path: &Path,
|
||||||
flags: Flags,
|
flags: Flags,
|
||||||
confirm: &Confirmation,
|
confirm: &Confirmation,
|
||||||
) -> crate::Result<bool> {
|
) -> crate::Result<bool> {
|
||||||
@ -83,6 +83,6 @@ pub fn permission_for_overwriting(
|
|||||||
Flags::None => {}
|
Flags::None => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
let file_path_str = &*path.as_path().to_string_lossy();
|
let file_path_str = path.to_string_lossy();
|
||||||
Ok(confirm.ask(Some(file_path_str))?)
|
confirm.ask(Some(&file_path_str))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user