From 15309c7debfeb94977d1622dc6ed604d32710435 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 3 Jan 2024 22:55:01 +0300 Subject: chore(ops/gerrit-autosubmit): clean up warnings & clippy lints Change-Id: I0e914d093b8fb45fa85bb19fb68c4f84f5ba6336 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10531 Tested-by: BuildkiteCI Autosubmit: tazjin Reviewed-by: flokli --- ops/gerrit-autosubmit/src/main.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ops/gerrit-autosubmit/src/main.rs b/ops/gerrit-autosubmit/src/main.rs index 9d7087d67deb..85d8a6af61bb 100644 --- a/ops/gerrit-autosubmit/src/main.rs +++ b/ops/gerrit-autosubmit/src/main.rs @@ -20,6 +20,7 @@ use anyhow::{Context, Result}; use std::collections::{BTreeMap, HashMap, HashSet}; +use std::{thread, time}; mod gerrit { use anyhow::{anyhow, Context, Result}; @@ -59,7 +60,7 @@ mod gerrit { pub enabled: bool, } - const GERRIT_RESPONSE_PREFIX: &'static str = ")]}'"; + const GERRIT_RESPONSE_PREFIX: &str = ")]}'"; pub fn get(cfg: &Config, endpoint: &str) -> Result { let response = crimp::Request::get(&format!("{}/a{}", cfg.gerrit_url, endpoint)) @@ -73,7 +74,7 @@ mod gerrit { } pub fn submit(cfg: &Config, change_id: &str) -> Result<()> { - let response = crimp::Request::post(&format!( + crimp::Request::post(&format!( "{}/a/changes/{}/submit", cfg.gerrit_url, change_id )) @@ -173,7 +174,7 @@ fn autosubmit(cfg: &gerrit::Config) -> Result { change_id, count ); - gerrit::submit(cfg, change_id); + gerrit::submit(cfg, change_id).context("while submitting")?; Ok(true) } else { @@ -187,7 +188,7 @@ fn main() -> Result<()> { loop { if !autosubmit(&cfg)? { - std::thread::sleep_ms(30000); + thread::sleep(time::Duration::from_secs(30)); } } } -- cgit 1.4.1