refactor: better value cloning
This commit is contained in:
+1
-1
@@ -29,7 +29,7 @@ pub(crate) struct Api {
|
|||||||
|
|
||||||
impl From<&Settings> for Api {
|
impl From<&Settings> for Api {
|
||||||
fn from(value: &Settings) -> Self {
|
fn from(value: &Settings) -> Self {
|
||||||
let contact = contact::ContactApi::from(value.clone().email);
|
let contact = contact::ContactApi::from(value.email.clone());
|
||||||
let health = health::HealthApi;
|
let health = health::HealthApi;
|
||||||
let meta = meta::MetaApi::from(&value.application);
|
let meta = meta::MetaApi::from(&value.application);
|
||||||
Self {
|
Self {
|
||||||
|
|||||||
+5
-5
@@ -108,8 +108,8 @@ impl Application {
|
|||||||
Self::prevent_unencrypted_smtp_with_credentials(settings);
|
Self::prevent_unencrypted_smtp_with_credentials(settings);
|
||||||
let api_service = OpenApiService::new(
|
let api_service = OpenApiService::new(
|
||||||
Api::from(settings).apis(),
|
Api::from(settings).apis(),
|
||||||
settings.application.clone().name,
|
settings.application.name.clone(),
|
||||||
settings.application.clone().version,
|
settings.application.version.clone(),
|
||||||
)
|
)
|
||||||
.url_prefix("/api");
|
.url_prefix("/api");
|
||||||
let ui = api_service.swagger_ui();
|
let ui = api_service.swagger_ui();
|
||||||
@@ -156,7 +156,7 @@ impl Application {
|
|||||||
tcp_listener: Option<poem::listener::TcpListener<String>>,
|
tcp_listener: Option<poem::listener::TcpListener<String>>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let port = settings.application.port;
|
let port = settings.application.port;
|
||||||
let host = settings.application.clone().host;
|
let host = settings.application.host.clone();
|
||||||
let app = Self::setup_app(&settings);
|
let app = Self::setup_app(&settings);
|
||||||
let server = Self::setup_server(&settings, tcp_listener);
|
let server = Self::setup_server(&settings, tcp_listener);
|
||||||
Self {
|
Self {
|
||||||
@@ -176,8 +176,8 @@ impl Application {
|
|||||||
|
|
||||||
/// Returns the host address the application is configured to bind to.
|
/// Returns the host address the application is configured to bind to.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn host(&self) -> String {
|
pub fn host(&self) -> &str {
|
||||||
self.host.clone()
|
&self.host
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the port the application is configured to bind to.
|
/// Returns the port the application is configured to bind to.
|
||||||
|
|||||||
Reference in New Issue
Block a user