diff --git a/frameworks/Rust/axum/src/database_pg_pool.rs b/frameworks/Rust/axum/src/database_pg_pool.rs index 28dc31b92826..f86c002845a6 100644 --- a/frameworks/Rust/axum/src/database_pg_pool.rs +++ b/frameworks/Rust/axum/src/database_pg_pool.rs @@ -1,4 +1,4 @@ -use std::{io, str::FromStr}; +use std::io; use axum::{ async_trait, @@ -33,8 +33,8 @@ pub async fn create_pool( database_url: String, max_pool_size: u32, ) -> deadpool_postgres::Pool { - let pg_config = - tokio_postgres::Config::from_str(&database_url).expect("invalid database url"); + let pg_config: tokio_postgres::Config = + database_url.parse().expect("invalid database url"); let mgr_config = ManagerConfig { recycling_method: RecyclingMethod::Fast, diff --git a/frameworks/Rust/axum/src/utils.rs b/frameworks/Rust/axum/src/utils.rs index ebb0a25b4ea5..a8f0b005d0e6 100644 --- a/frameworks/Rust/axum/src/utils.rs +++ b/frameworks/Rust/axum/src/utils.rs @@ -12,11 +12,10 @@ pub fn get_environment_variable(key: &str) -> T where ::Err: Debug, { - T::from_str( - &env::var(key) - .unwrap_or_else(|_| panic!("{} environment variable was not set", key)), - ) - .unwrap_or_else(|_| panic!("could not parse {}", key)) + env::var(key) + .unwrap_or_else(|_| panic!("{} environment variable was not set", key)) + .parse::() + .unwrap_or_else(|_| panic!("could not parse {}", key)) } #[derive(Debug, Deserialize)]