diff --git a/src/agent/onefuzz-agent/src/local/common.rs b/src/agent/onefuzz-agent/src/local/common.rs index 4b7b87f12..aa0783525 100644 --- a/src/agent/onefuzz-agent/src/local/common.rs +++ b/src/agent/onefuzz-agent/src/local/common.rs @@ -150,8 +150,7 @@ pub fn get_synced_dirs( args: &ArgMatches<'_>, ) -> Result> { let current_dir = std::env::current_dir()?; - let dirs: Result> = args - .values_of_os(name) + args.values_of_os(name) .ok_or_else(|| anyhow!("argument '{}' not specified", name))? .enumerate() .map(|(index, remote_path)| { @@ -165,8 +164,7 @@ pub fn get_synced_dirs( path, }) }) - .collect(); - Ok(dirs?) + .collect() } fn register_cleanup(job_id: Uuid) -> Result<()> { diff --git a/src/agent/onefuzz-agent/src/tasks/merge/generic.rs b/src/agent/onefuzz-agent/src/tasks/merge/generic.rs index c046c7f02..5bf0d4c2c 100644 --- a/src/agent/onefuzz-agent/src/tasks/merge/generic.rs +++ b/src/agent/onefuzz-agent/src/tasks/merge/generic.rs @@ -93,7 +93,7 @@ pub async fn spawn(config: Arc) -> Result<()> { } } -async fn process_message(config: Arc, input_url: &Url, tmp_dir: &PathBuf) -> Result<()> { +async fn process_message(config: Arc, input_url: &Url, tmp_dir: &Path) -> Result<()> { let input_path = utils::download_input(input_url.clone(), &config.unique_inputs.path).await?; info!("downloaded input to {}", input_path.display()); @@ -101,11 +101,11 @@ async fn process_message(config: Arc, input_url: &Url, tmp_dir: &PathBuf match merge(&config, tmp_dir).await { Ok(_) => { // remove the 'queue' folder - let mut queue_dir = tmp_dir.clone(); + let mut queue_dir = tmp_dir.to_path_buf(); queue_dir.push("queue"); let _delete_output = tokio::fs::remove_dir_all(queue_dir).await; let synced_dir = SyncedDir { - path: tmp_dir.clone(), + path: tmp_dir.to_path_buf(), url: config.unique_inputs.url.clone(), }; synced_dir.sync_push().await? diff --git a/src/agent/onefuzz-agent/src/tasks/stats/common.rs b/src/agent/onefuzz-agent/src/tasks/stats/common.rs index 1859ced30..0f4768a97 100644 --- a/src/agent/onefuzz-agent/src/tasks/stats/common.rs +++ b/src/agent/onefuzz-agent/src/tasks/stats/common.rs @@ -8,9 +8,11 @@ use onefuzz_telemetry::Event::runtime_stats; use serde::Deserialize; pub const STATS_DELAY: std::time::Duration = std::time::Duration::from_secs(30); +// TODO - remove unkonwn_lints once GitHub build agents are at 1.51.0 or later #[derive(Debug, Deserialize, Clone)] pub enum StatsFormat { - AFL, + #[serde(alias = "AFL")] + Afl, } pub async fn monitor_stats(path: Option, format: Option) -> Result<(), Error> { @@ -18,7 +20,7 @@ pub async fn monitor_stats(path: Option, format: Option) -> if let Some(format) = format { loop { let stats = match format { - StatsFormat::AFL => afl::read_stats(&path).await, + StatsFormat::Afl => afl::read_stats(&path).await, }; if let Ok(stats) = stats { log_events!(runtime_stats; stats); diff --git a/src/agent/onefuzz/src/env.rs b/src/agent/onefuzz/src/env.rs index 7931a5b22..5fff86c08 100644 --- a/src/agent/onefuzz/src/env.rs +++ b/src/agent/onefuzz/src/env.rs @@ -8,6 +8,7 @@ use std::path::PathBuf; pub const PATH: &str = "PATH"; pub const LD_LIBRARY_PATH: &str = "LD_LIBRARY_PATH"; +#[allow(clippy::ptr_arg)] pub fn update_path(path: OsString, to_add: &PathBuf) -> Result { let mut paths: Vec<_> = std::env::split_paths(&path).collect(); if !paths.contains(to_add) { @@ -16,6 +17,7 @@ pub fn update_path(path: OsString, to_add: &PathBuf) -> Result { Ok(std::env::join_paths(paths)?) } +#[allow(clippy::ptr_arg)] pub fn get_path_with_directory(variable: &str, to_add: &PathBuf) -> Result { match std::env::var_os(variable) { Some(path) => update_path(path, to_add),