We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 620e86e commit dd67e90Copy full SHA for dd67e90
src/utils/from_env.rs
@@ -274,19 +274,19 @@ impl FromEnvVar for std::time::Duration {
274
275
impl<T> FromEnvVar for Vec<T>
276
where
277
- T: FromEnvVar,
+ T: From<String> + core::fmt::Debug + 'static,
278
{
279
- type Error = T::Error;
+ type Error = Infallible;
280
281
fn from_env_var(env_var: &str) -> Result<Self, FromEnvErr<Self::Error>> {
282
let s = std::env::var(env_var).map_err(|e| FromEnvErr::env_err(env_var, e))?;
283
if s.is_empty() {
284
return Ok(vec![]);
285
}
286
- s.split(',')
287
- .map(|s| T::from_env_var(s))
288
- .collect::<Result<Vec<_>, _>>()
289
- .map_err(FromEnvErr::from)
+ Ok(s.split(',')
+ .map(str::to_string)
+ .map(Into::into)
+ .collect::<Vec<_>>())
290
291
292
0 commit comments