From 85be6e2e6d2b7d42749e0342b3517e5667cba499 Mon Sep 17 00:00:00 2001 From: Fabian Braun Date: Sun, 1 Dec 2024 16:28:54 +0200 Subject: [PATCH 1/4] Upgrade MSRV & dependencies --- Cargo.toml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9ed08d7..a927888 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,15 +7,15 @@ repository = "https://github.com/vmx/temp-env" description = "Set environment variables temporarily." keywords = ["env", "environment", "envvar", "temporary", "testing"] categories = ["development-tools", "development-tools::testing"] -edition = "2018" -rust-version = "1.62.1" +edition = "2021" +rust-version = "1.63.0" [dependencies] -futures = { version = "0.3.21", optional = true } -parking_lot = "0.12.1" +futures = { version = "0.3.31", optional = true } +parking_lot = { version = "0.12.3" } [dev-dependencies] -tokio = { version = "1.21.1", features = ["full"]} +tokio = { version = "1.38.1", features = ["full"]} [features] default = [] From 740e3ebc04ae0b27ee451d801d460424ec3102dc Mon Sep 17 00:00:00 2001 From: Fabian Braun Date: Sun, 1 Dec 2024 16:31:17 +0200 Subject: [PATCH 2/4] Lint --- src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 33ecea0..310e318 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -107,7 +107,7 @@ impl<'a> RestoreEnv<'a> { } } -impl<'a> Drop for RestoreEnv<'a> { +impl Drop for RestoreEnv<'_> { fn drop(&mut self) { for (var, value) in self.env.iter() { update_env(var, value.as_ref().map(|v| v.as_os_str())); @@ -191,7 +191,7 @@ where /// let v = std::env::var("MY_VAR").unwrap(); /// assert_eq!(v, "ok".to_owned()); /// } - +/// /// #[tokio::test] /// async fn test_async_closure() { /// crate::async_with_vars([("MY_VAR", Some("ok"))], check_var()); From f296f018fab2ade267c51ee3e80fc47331d0ec1c Mon Sep 17 00:00:00 2001 From: Fabian Braun Date: Sun, 1 Dec 2024 16:34:33 +0200 Subject: [PATCH 3/4] Fix minor style problems --- src/lib.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 310e318..d056aef 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -192,6 +192,7 @@ where /// assert_eq!(v, "ok".to_owned()); /// } /// +/// #[cfg(feature = "async_closure")] /// #[tokio::test] /// async fn test_async_closure() { /// crate::async_with_vars([("MY_VAR", Some("ok"))], check_var()); @@ -546,7 +547,7 @@ mod tests { #[cfg(feature = "async_closure")] async fn check_var() { - let v = std::env::var("MY_VAR").unwrap(); + let v = env::var("MY_VAR").unwrap(); assert_eq!(v, "ok".to_owned()); } @@ -555,7 +556,7 @@ mod tests { async fn test_async_closure() { crate::async_with_vars([("MY_VAR", Some("ok"))], check_var()).await; let f = async { - let v = std::env::var("MY_VAR").unwrap(); + let v = env::var("MY_VAR").unwrap(); assert_eq!(v, "ok".to_owned()); }; crate::async_with_vars([("MY_VAR", Some("ok"))], f).await; @@ -566,7 +567,7 @@ mod tests { async fn test_async_closure_calls_closure() { let (tx, rx) = tokio::sync::oneshot::channel(); let f = async { - tx.send(std::env::var("MY_VAR")).unwrap(); + tx.send(env::var("MY_VAR")).unwrap(); }; crate::async_with_vars([("MY_VAR", Some("ok"))], f).await; let value = rx.await.unwrap().unwrap(); From bbd62beb32a07c3c9ec4e2b2fc620e2a65ab4449 Mon Sep 17 00:00:00 2001 From: Fabian Braun Date: Sun, 1 Dec 2024 16:35:40 +0200 Subject: [PATCH 4/4] Fix MSRV in CI --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2d89e5a..d21fd75 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,7 +3,7 @@ name: build on: [push, pull_request] env: - MSRV: 1.62.1 + MSRV: 1.63.0 jobs: msrv: