From b97fb22d86f10ae72642111ba3b6986509d37dec Mon Sep 17 00:00:00 2001 From: Fabian Braun Date: Wed, 4 Dec 2024 00:21:28 +0200 Subject: [PATCH] chore: upgrade MSRV & dependencies (#26) libc v0.2.167 needs at least Rust 1.63, hence bump the MSRV. Also take the chance and update the dependencies. --- .github/workflows/build.yml | 2 +- Cargo.toml | 10 +++++----- src/lib.rs | 11 ++++++----- 3 files changed, 12 insertions(+), 11 deletions(-) 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: 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 = [] diff --git a/src/lib.rs b/src/lib.rs index 33ecea0..d056aef 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,8 @@ where /// let v = std::env::var("MY_VAR").unwrap(); /// 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();