From d8d89275a6a42ca1e0d691e8b8115fe8acbf06cd Mon Sep 17 00:00:00 2001 From: Marc Schoolderman Date: Mon, 8 Jan 2024 14:07:21 +0100 Subject: [PATCH] updates to pass 1.75 version of clippy --- src/common/command.rs | 2 +- src/common/error.rs | 6 +++--- src/sudo/pipeline.rs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/common/command.rs b/src/common/command.rs index fd3b8a0db..14b0ab96c 100644 --- a/src/common/command.rs +++ b/src/common/command.rs @@ -63,7 +63,7 @@ impl CommandAndArguments { arguments = vec!["-c".to_string(), escaped(arguments)] } } else { - command = arguments.get(0).map(|s| s.into()).unwrap_or_default(); + command = arguments.first().map(|s| s.into()).unwrap_or_default(); arguments.remove(0); // remember the original binary name before resolving symlinks; this is not diff --git a/src/common/error.rs b/src/common/error.rs index b022e02a5..97829e6b6 100644 --- a/src/common/error.rs +++ b/src/common/error.rs @@ -25,7 +25,7 @@ pub enum Error { Configuration(String), Options(String), Pam(PamError), - IoError(Option, std::io::Error), + Io(Option, std::io::Error), MaxAuthAttempts(usize), PathValidation(PathBuf), StringValidation(String), @@ -64,7 +64,7 @@ impl fmt::Display for Error { Error::Configuration(e) => write!(f, "invalid configuration: {e}"), Error::Options(e) => write!(f, "{e}"), Error::Pam(e) => write!(f, "PAM error: {e}"), - Error::IoError(location, e) => { + Error::Io(location, e) => { if let Some(path) = location { write!(f, "cannot execute '{}': {e}", path.display()) } else { @@ -98,7 +98,7 @@ impl From for Error { impl From for Error { fn from(err: std::io::Error) -> Self { - Error::IoError(None, err) + Error::Io(None, err) } } diff --git a/src/sudo/pipeline.rs b/src/sudo/pipeline.rs index 56890e75f..0fddd2d57 100644 --- a/src/sudo/pipeline.rs +++ b/src/sudo/pipeline.rs @@ -86,7 +86,7 @@ impl Pipeline { log_command_execution(&context); crate::exec::run_command(&context, target_env) - .map_err(|io_error| Error::IoError(Some(context.command.command), io_error)) + .map_err(|io_error| Error::Io(Some(context.command.command), io_error)) } else { Err(Error::CommandNotFound(context.command.command)) };