Skip to content

Commit f6dae77

Browse files
authored
Shorten Readme (#33)
1 parent e02bac8 commit f6dae77

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

README.md

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,37 +13,33 @@ Examples
1313

1414
```rust
1515
temp_env::with_var("MY_ENV_VAR", Some("production"), || {
16-
// Run some code where `MY_ENV_VAR` set to `"production"`.
16+
// Run some code where `MY_ENV_VAR` is set to `production`.
1717
});
1818

1919

2020
temp_env::with_vars(
2121
[
22-
("FIRST_VAR", Some("Hello")),
23-
("SECOND_VAR", Some("World!")),
22+
("FIRST", Some("Hello")),
23+
("SECOND", Some("World!")),
2424
],
2525
|| {
26-
// Run some code where `FIRST_VAR` is set to `"Hello"` and `SECOND_VAR` is set to
27-
// `"World!"`.
26+
// Run some code where `FIRST` is set to `Hello` and `SECOND` is set to `World!`.
2827
}
2928
);
3029

3130
temp_env::with_vars(
3231
[
33-
("FIRST_VAR", Some("Hello")),
34-
("SECOND_VAR", None),
32+
("FIRST", Some("Hello")),
33+
("SECOND", None),
3534
],
3635
|| {
37-
// Run some code where `FIRST_VAR` is set to `"Hello"` and `SECOND_VAR` is unset (even if
36+
// Run some code where `FIRST` is set to `Hello` and `SECOND` is unset (even if
3837
// it was set before)
3938
}
4039
);
41-
```
42-
43-
Starting from version 0.3.0 you can return a value from inside the closure:
4440

45-
```rust
46-
let r = temp_env::with_var("MY_ENV_VAR", Some("production"), || {
41+
let value = temp_env::with_var("MY_ENV_VAR", Some("production"), || {
42+
// Compute a value in a closure while `MY_ENV_VAR` is set to `production`.
4743
let envvar = env::var("MY_ENV_VAR").unwrap();
4844
if envvar == "production" {
4945
true

0 commit comments

Comments
 (0)