Skip to content

Commit 34adf9a

Browse files
authored
Merge pull request #103 from ZaneHannanAU/from-into-trait-directly
Simplify `From` calls
2 parents d8a025d + 6c5100b commit 34adf9a

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

src/connector.rs

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,7 @@ impl HttpsConnector<HttpConnector> {
4545
}
4646
};
4747
config.ct_logs = Some(&ct_logs::LOGS);
48-
HttpsConnector {
49-
http,
50-
tls_config: Arc::new(config),
51-
}
48+
(http, config).into()
5249
}
5350
}
5451

@@ -65,20 +62,14 @@ impl<T> fmt::Debug for HttpsConnector<T> {
6562
}
6663
}
6764

68-
impl<T> From<(T, ClientConfig)> for HttpsConnector<T> {
69-
fn from(args: (T, ClientConfig)) -> Self {
70-
HttpsConnector {
71-
http: args.0,
72-
tls_config: Arc::new(args.1),
73-
}
74-
}
75-
}
76-
77-
impl<T> From<(T, Arc<ClientConfig>)> for HttpsConnector<T> {
78-
fn from(args: (T, Arc<ClientConfig>)) -> Self {
65+
impl<H, C> From<(H, C)> for HttpsConnector<H>
66+
where
67+
C: Into<Arc<ClientConfig>>
68+
{
69+
fn from((http, cfg): (H, C)) -> Self {
7970
HttpsConnector {
80-
http: args.0,
81-
tls_config: args.1,
71+
http,
72+
tls_config: cfg.into(),
8273
}
8374
}
8475
}

0 commit comments

Comments
 (0)