summaryrefslogtreecommitdiff
path: root/src/config
diff options
context:
space:
mode:
authorStuart Stock <stuart@int08h.com>2018-10-21 17:30:57 -0500
committerStuart Stock <stuart@int08h.com>2018-10-21 17:30:57 -0500
commit68788da97001f27702f5b9c7b2812dcab7bec24a (patch)
tree1f05a4ca7815e383705706ed758e10b81d068f03 /src/config
parent608e43e4843fef6081ce3cac2186e0291b73e0cb (diff)
downloadroughenough-68788da97001f27702f5b9c7b2812dcab7bec24a.zip
Changes to keep Clippy happy
Diffstat (limited to 'src/config')
-rw-r--r--src/config/environment.rs10
-rw-r--r--src/config/file.rs2
2 files changed, 6 insertions, 6 deletions
diff --git a/src/config/environment.rs b/src/config/environment.rs
index 5edb6d0..d051d6d 100644
--- a/src/config/environment.rs
+++ b/src/config/environment.rs
@@ -65,7 +65,7 @@ impl EnvironmentConfig {
if let Ok(port) = env::var(ROUGHENOUGH_PORT) {
cfg.port = port
.parse()
- .expect(format!("invalid port: {}", port).as_ref());
+ .unwrap_or_else(|_| panic!("invalid port: {}", port));
};
if let Ok(interface) = env::var(ROUGHENOUGH_INTERFACE) {
@@ -80,21 +80,21 @@ impl EnvironmentConfig {
if let Ok(batch_size) = env::var(ROUGHENOUGH_BATCH_SIZE) {
cfg.batch_size = batch_size
.parse()
- .expect(format!("invalid batch_size: {}", batch_size).as_ref());
+ .unwrap_or_else(|_| panic!("invalid batch_size: {}", batch_size));
};
if let Ok(status_interval) = env::var(ROUGHENOUGH_STATUS_INTERVAL) {
let val: u16 = status_interval
.parse()
- .expect(format!("invalid status_interval: {}", status_interval).as_ref());
+ .unwrap_or_else(|_| panic!("invalid status_interval: {}", status_interval));
- cfg.status_interval = Duration::from_secs(val as u64);
+ cfg.status_interval = Duration::from_secs(u64::from(val));
};
if let Ok(key_protection) = env::var(ROUGHENOUGH_KEY_PROTECTION) {
cfg.key_protection = key_protection
.parse()
- .expect(format!("invalid key_protection value: {}", key_protection).as_ref());
+ .unwrap_or_else(|_| panic!("invalid key_protection value: {}", key_protection));
}
Ok(cfg)
diff --git a/src/config/file.rs b/src/config/file.rs
index b0f8b4d..b1e856b 100644
--- a/src/config/file.rs
+++ b/src/config/file.rs
@@ -90,7 +90,7 @@ impl FileConfig {
.as_str()
.unwrap()
.parse()
- .expect(format!("invalid key_protection value: {:?}", value).as_ref());
+ .unwrap_or_else(|_| panic!("invalid key_protection value: {:?}", value));
config.key_protection = val
}
unknown => {