updates related to cargo clippy 1.51.0 (#730)

This commit is contained in:
bmc-msft
2021-04-01 13:08:21 -04:00
committed by GitHub
parent 03fc386106
commit f6adad3ed9
4 changed files with 11 additions and 9 deletions

View File

@ -150,8 +150,7 @@ pub fn get_synced_dirs(
args: &ArgMatches<'_>,
) -> Result<Vec<SyncedDir>> {
let current_dir = std::env::current_dir()?;
let dirs: Result<Vec<SyncedDir>> = 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<()> {

View File

@ -93,7 +93,7 @@ pub async fn spawn(config: Arc<Config>) -> Result<()> {
}
}
async fn process_message(config: Arc<Config>, input_url: &Url, tmp_dir: &PathBuf) -> Result<()> {
async fn process_message(config: Arc<Config>, 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<Config>, 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?

View File

@ -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<String>, format: Option<StatsFormat>) -> Result<(), Error> {
@ -18,7 +20,7 @@ pub async fn monitor_stats(path: Option<String>, format: Option<StatsFormat>) ->
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);