summaryrefslogtreecommitdiff
path: root/instrumentation/src/utils.rs
diff options
context:
space:
mode:
Diffstat (limited to 'instrumentation/src/utils.rs')
-rw-r--r--instrumentation/src/utils.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/instrumentation/src/utils.rs b/instrumentation/src/utils.rs
index 158876b..835764a 100644
--- a/instrumentation/src/utils.rs
+++ b/instrumentation/src/utils.rs
@@ -20,7 +20,7 @@ use std::{
io::Write as _,
net::{Ipv4Addr, SocketAddrV4, TcpListener, TcpStream},
ops::{Deref, DerefMut},
- path::PathBuf,
+ path::{Path, PathBuf},
process::{Child, Command, Stdio},
str::FromStr,
sync::{Arc, Mutex},
@@ -194,7 +194,7 @@ pub fn retry_opt<T>(mut lambda: impl FnMut() -> Option<T>) -> T {
}
pub fn retry(mut lambda: impl FnMut() -> bool) {
- retry_opt(|| lambda().then(|| ()))
+ retry_opt(|| lambda().then_some(()))
}
#[derive(Clone)]
@@ -206,12 +206,12 @@ pub struct TestCtx {
impl TestCtx {
pub fn new(name: &str) -> Self {
// Create log dir
- let log_dir = format!("log/{name}").into();
+ let log_dir = format!("log/{name}");
std::fs::remove_dir_all(&log_dir).ok();
std::fs::create_dir_all(&log_dir).unwrap();
// Generate password
let pwd: String = (0..30).map(|_| fastrand::alphanumeric()).collect();
- std::env::set_var("PASSWORD", &pwd);
+ std::env::set_var("PASSWORD", pwd);
Self {
log_dir,
@@ -315,7 +315,7 @@ impl TalerCtx {
),
)
.unwrap();
- let db = TalerCtx::start_db(&db_dir, &ctx);
+ let db = TalerCtx::start_db(&db_dir, ctx);
retry(|| {
let mut psql = ChildGuard(
Command::new("psql")
@@ -325,7 +325,7 @@ impl TalerCtx {
std::fs::File::options()
.append(true)
.create(true)
- .open(&ctx.log("postgres"))
+ .open(ctx.log("postgres"))
.unwrap(),
)
.stdin(Stdio::piped())
@@ -430,7 +430,7 @@ impl TalerCtx {
/* ----- Database ----- */
- fn start_db(db_dir: &PathBuf, ctx: &TestCtx) -> ChildGuard {
+ fn start_db(db_dir: &Path, ctx: &TestCtx) -> ChildGuard {
cmd_redirect(
"postgres",
&["-D", db_dir.to_string_lossy().as_ref()],