From 0f114f21344ddb59f50fed68540c54c41300cf51 Mon Sep 17 00:00:00 2001 From: LUXEY Adrien Date: Mon, 16 Aug 2021 11:34:42 +0200 Subject: a last pass to remove warnings from my code --- src/config/options.rs | 2 ++ src/config/options_test.rs | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/config/options.rs b/src/config/options.rs index 27b1af1..36da475 100644 --- a/src/config/options.rs +++ b/src/config/options.rs @@ -59,6 +59,8 @@ impl ConfigOpts { }) } + // Currently only used in tests + #[allow(dead_code)] pub fn from_iter(iter: Iter) -> Result where Iter: IntoIterator { let base: ConfigOptsBase = envy::prefixed("DIPLONAT_").from_iter(iter.clone())?; diff --git a/src/config/options_test.rs b/src/config/options_test.rs index 7c41fce..a6063fd 100644 --- a/src/config/options_test.rs +++ b/src/config/options_test.rs @@ -1,5 +1,4 @@ use std::collections::HashMap; -use std::env; use std::time::Duration; use crate::config::*; @@ -30,7 +29,9 @@ fn all_valid_options() -> HashMap { #[test] #[should_panic] fn err_empty_env() { - ConfigOpts::from_env(); + std::env::remove_var("DIPLONAT_PRIVATE_IP"); + std::env::remove_var("DIPLONAT_CONSUL_NODE_NAME"); + ConfigOpts::from_env().unwrap(); } #[test] @@ -71,7 +72,7 @@ fn err_from_iter_invalid_refresh_time() { let mut opts = minimal_valid_options(); opts.insert("DIPLONAT_EXPIRATION_TIME".to_string(), "60".to_string()); opts.insert("DIPLONAT_REFRESH_TIME".to_string(), "60".to_string()); - let rt_config = ConfigOpts::from_iter(opts.clone()).unwrap(); + ConfigOpts::from_iter(opts).unwrap(); } #[test] -- cgit v1.2.3