feat: use Self instead of struct name whereas applicable

This commit is contained in:
CosminPerRam 2024-05-01 18:46:37 +03:00
parent f53635993e
commit 1877a16457
2 changed files with 4 additions and 4 deletions

View file

@ -224,7 +224,7 @@ pub struct EcoRequestSettings {
impl From<ExtraRequestSettings> for EcoRequestSettings { impl From<ExtraRequestSettings> for EcoRequestSettings {
fn from(value: ExtraRequestSettings) -> Self { fn from(value: ExtraRequestSettings) -> Self {
EcoRequestSettings { Self {
hostname: value.hostname, hostname: value.hostname,
} }
} }
@ -232,7 +232,7 @@ impl From<ExtraRequestSettings> for EcoRequestSettings {
impl From<EcoRequestSettings> for HttpSettings<String> { impl From<EcoRequestSettings> for HttpSettings<String> {
fn from(value: EcoRequestSettings) -> Self { fn from(value: EcoRequestSettings) -> Self {
HttpSettings { Self {
protocol: HttpProtocol::Http, protocol: HttpProtocol::Http,
hostname: value.hostname, hostname: value.hostname,
headers: Vec::with_capacity(0), headers: Vec::with_capacity(0),

View file

@ -194,7 +194,7 @@ impl HttpClient {
url: U, url: U,
timeout_settings: &Option<TimeoutSettings>, timeout_settings: &Option<TimeoutSettings>,
headers: Option<Vec<(&str, &str)>>, headers: Option<Vec<(&str, &str)>>,
) -> GDResult<HttpClient> ) -> GDResult<Self>
where where
U::Error: std::error::Error + Send + Sync + 'static, U::Error: std::error::Error + Send + Sync + 'static,
{ {
@ -229,7 +229,7 @@ impl HttpClient {
headers: headers.unwrap_or_default(), headers: headers.unwrap_or_default(),
}; };
HttpClient::new(&address, timeout_settings, http_settings) Self::new(&address, timeout_settings, http_settings)
} }
/// Send a HTTP GET request and return the response data as a buffer. /// Send a HTTP GET request and return the response data as a buffer.