Fix clippy lints in unit tests

This commit is contained in:
Amanda Graven 2021-09-21 14:14:53 +02:00
parent 9424605cfb
commit 4c52fe9f24
No known key found for this signature in database
GPG key ID: 45C461CDC9286390

View file

@ -296,7 +296,7 @@ mod tests {
let _ = dotenv::dotenv(); let _ = dotenv::dotenv();
INIT_LOGGER.call_once(|| pretty_env_logger::init()); INIT_LOGGER.call_once(pretty_env_logger::init);
let pool = Pool::connect(&env::var("DATABASE_URL").unwrap()) let pool = Pool::connect(&env::var("DATABASE_URL").unwrap())
.await .await
@ -384,7 +384,7 @@ mod tests {
{ {
let pool = &*test_pool().await; let pool = &*test_pool().await;
let (_runner, counter) = let (_runner, counter) =
test_job_runner(&pool, |mut job| async move { job.complete().await }).await; test_job_runner(pool, |mut job| async move { job.complete().await }).await;
assert_eq!(counter.load(Ordering::SeqCst), 0); assert_eq!(counter.load(Ordering::SeqCst), 0);
JobBuilder::new("foo").spawn(pool).await.unwrap(); JobBuilder::new("foo").spawn(pool).await.unwrap();
@ -432,7 +432,7 @@ mod tests {
sqlxmq::clear(pool, &["foo", "baz"]).await.unwrap(); sqlxmq::clear(pool, &["foo", "baz"]).await.unwrap();
let (_runner, counter) = let (_runner, counter) =
test_job_runner(&pool, |mut job| async move { job.complete().await }).await; test_job_runner(pool, |mut job| async move { job.complete().await }).await;
pause().await; pause().await;
assert_eq!(counter.load(Ordering::SeqCst), 2); assert_eq!(counter.load(Ordering::SeqCst), 2);
@ -446,7 +446,7 @@ mod tests {
let pool = &*test_pool().await; let pool = &*test_pool().await;
let (tx, mut rx) = mpsc::unbounded(); let (tx, mut rx) = mpsc::unbounded();
let (_runner, counter) = test_job_runner(&pool, move |job| { let (_runner, counter) = test_job_runner(pool, move |job| {
let tx = tx.clone(); let tx = tx.clone();
async move { async move {
tx.unbounded_send(job).unwrap(); tx.unbounded_send(job).unwrap();
@ -484,7 +484,7 @@ mod tests {
let pool = &*test_pool().await; let pool = &*test_pool().await;
let (tx, mut rx) = mpsc::unbounded(); let (tx, mut rx) = mpsc::unbounded();
let (_runner, counter) = test_job_runner(&pool, move |job| { let (_runner, counter) = test_job_runner(pool, move |job| {
let tx = tx.clone(); let tx = tx.clone();
async move { async move {
tx.unbounded_send(job).unwrap(); tx.unbounded_send(job).unwrap();
@ -511,7 +511,7 @@ mod tests {
async fn it_retries_failed_jobs() { async fn it_retries_failed_jobs() {
{ {
let pool = &*test_pool().await; let pool = &*test_pool().await;
let (_runner, counter) = test_job_runner(&pool, move |_| async {}).await; let (_runner, counter) = test_job_runner(pool, move |_| async {}).await;
let backoff = 500; let backoff = 500;
@ -548,7 +548,7 @@ mod tests {
async fn it_can_checkpoint_jobs() { async fn it_can_checkpoint_jobs() {
{ {
let pool = &*test_pool().await; let pool = &*test_pool().await;
let (_runner, counter) = test_job_runner(&pool, move |mut current_job| async move { let (_runner, counter) = test_job_runner(pool, move |mut current_job| async move {
let state: bool = current_job.json().unwrap().unwrap(); let state: bool = current_job.json().unwrap().unwrap();
if state { if state {
current_job.complete().await.unwrap(); current_job.complete().await.unwrap();