Skip to content

Commit

Permalink
chore: upgrade MSRV & dependencies (#26)
Browse files Browse the repository at this point in the history
libc v0.2.167 needs at least Rust 1.63, hence bump the MSRV.

Also take the chance and update the dependencies.
  • Loading branch information
fabian-braun authored Dec 3, 2024
1 parent 0a73ae3 commit b97fb22
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: build
on: [push, pull_request]

env:
MSRV: 1.62.1
MSRV: 1.63.0

jobs:
msrv:
Expand Down
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down
11 changes: 6 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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());
}

Expand All @@ -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;
Expand All @@ -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();
Expand Down

0 comments on commit b97fb22

Please sign in to comment.