Skip to content

Commit cfd385e

Browse files
committed
Fix env tests, remove unused import
1 parent c06915e commit cfd385e

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/env.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use std::collections::HashMap;
2-
use std::convert::TryInto;
32
use std::env;
43

54
use crate::error::*;

tests/env.rs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
extern crate config;
22
extern crate serde_derive;
33

4-
use std::env;
54
use config::*;
65
use serde_derive::Deserialize;
6+
use std::env;
77

88
/// Reminder that tests using env variables need to use different env variable names, since
99
/// tests can be run in parallel
@@ -88,6 +88,7 @@ fn test_custom_separator_behavior() {
8888
env::remove_var("C.B.A");
8989
}
9090

91+
#[test]
9192
fn test_parse_int() {
9293
// using a struct in an enum here to make serde use `deserialize_any`
9394
#[derive(Deserialize, Debug)]
@@ -104,7 +105,7 @@ fn test_parse_int() {
104105
env::set_var("INT_VAL", "42");
105106

106107
let environment = Environment::new().try_parsing(true);
107-
let mut config = Config::new();
108+
let mut config = Config::default();
108109

109110
config.set("tag", "Int").unwrap();
110111

@@ -134,7 +135,7 @@ fn test_parse_float() {
134135
env::set_var("FLOAT_VAL", "42.3");
135136

136137
let environment = Environment::new().try_parsing(true);
137-
let mut config = Config::new();
138+
let mut config = Config::default();
138139

139140
config.set("tag", "Float").unwrap();
140141

@@ -167,7 +168,7 @@ fn test_parse_bool() {
167168
env::set_var("BOOL_VAL", "true");
168169

169170
let environment = Environment::new().try_parsing(true);
170-
let mut config = Config::new();
171+
let mut config = Config::default();
171172

172173
config.set("tag", "Bool").unwrap();
173174

@@ -201,7 +202,7 @@ fn test_parse_off_int() {
201202
env::set_var("INT_VAL_1", "42");
202203

203204
let environment = Environment::new().try_parsing(false);
204-
let mut config = Config::new();
205+
let mut config = Config::default();
205206

206207
config.set("tag", "Int").unwrap();
207208

@@ -230,7 +231,7 @@ fn test_parse_off_float() {
230231
env::set_var("FLOAT_VAL_1", "42.3");
231232

232233
let environment = Environment::new().try_parsing(false);
233-
let mut config = Config::new();
234+
let mut config = Config::default();
234235

235236
config.set("tag", "Float").unwrap();
236237

@@ -259,7 +260,7 @@ fn test_parse_off_bool() {
259260
env::set_var("BOOL_VAL_1", "true");
260261

261262
let environment = Environment::new().try_parsing(false);
262-
let mut config = Config::new();
263+
let mut config = Config::default();
263264

264265
config.set("tag", "Bool").unwrap();
265266

@@ -288,7 +289,7 @@ fn test_parse_int_fail() {
288289
env::set_var("INT_VAL_2", "not an int");
289290

290291
let environment = Environment::new().try_parsing(true);
291-
let mut config = Config::new();
292+
let mut config = Config::default();
292293

293294
config.set("tag", "Int").unwrap();
294295

@@ -317,7 +318,7 @@ fn test_parse_float_fail() {
317318
env::set_var("FLOAT_VAL_2", "not a float");
318319

319320
let environment = Environment::new().try_parsing(true);
320-
let mut config = Config::new();
321+
let mut config = Config::default();
321322

322323
config.set("tag", "Float").unwrap();
323324

@@ -346,7 +347,7 @@ fn test_parse_bool_fail() {
346347
env::set_var("BOOL_VAL_2", "not a bool");
347348

348349
let environment = Environment::new().try_parsing(true);
349-
let mut config = Config::new();
350+
let mut config = Config::default();
350351

351352
config.set("tag", "Bool").unwrap();
352353

@@ -374,7 +375,7 @@ fn test_parse_string() {
374375
env::set_var("STRING_VAL", "test string");
375376

376377
let environment = Environment::new().try_parsing(true);
377-
let mut config = Config::new();
378+
let mut config = Config::default();
378379

379380
config.set("tag", "String").unwrap();
380381

@@ -408,7 +409,7 @@ fn test_parse_off_string() {
408409
env::set_var("STRING_VAL_1", "test string");
409410

410411
let environment = Environment::new().try_parsing(false);
411-
let mut config = Config::new();
412+
let mut config = Config::default();
412413

413414
config.set("tag", "String").unwrap();
414415

0 commit comments

Comments
 (0)