Remove useless Result, native_tls dependency

This commit is contained in:
Jonas Platte 2019-12-13 00:00:09 +01:00
parent 5e2f965058
commit c0390aba0d
No known key found for this signature in database
GPG Key ID: 7D261D771D915378
2 changed files with 4 additions and 7 deletions

View File

@ -22,7 +22,6 @@ ruma-api = "0.12.0"
ruma-client-api = "0.5.0"
ruma-events = "0.15.1"
ruma-identifiers = "0.14.0"
native-tls = { version = "0.2.3", optional = true }
serde = { version = "1.0.103", features = ["derive"] }
serde_json = "1.0.44"
serde_urlencoded = "0.6.1"
@ -34,4 +33,4 @@ tokio = { version = "0.2.4", features = ["macros"] }
[features]
default = ["tls"]
tls = ["hyper-tls", "native-tls"]
tls = ["hyper-tls"]

View File

@ -100,8 +100,6 @@ use hyper::{
};
#[cfg(feature = "hyper-tls")]
use hyper_tls::HttpsConnector;
#[cfg(feature = "hyper-tls")]
use native_tls::Error as NativeTlsError;
use ruma_api::{Endpoint, Outgoing};
use tokio::io::{AsyncRead, AsyncWrite};
use url::Url;
@ -165,14 +163,14 @@ pub type HttpsClient = Client<HttpsConnector<HttpConnector>>;
#[cfg(feature = "tls")]
impl HttpsClient {
/// Creates a new client for making HTTPS requests to the given homeserver.
pub fn https(homeserver_url: Url, session: Option<Session>) -> Result<Self, NativeTlsError> {
pub fn https(homeserver_url: Url, session: Option<Session>) -> Self {
let connector = HttpsConnector::new();
Ok(Self(Arc::new(ClientData {
Self(Arc::new(ClientData {
homeserver_url,
hyper: HyperClient::builder().keep_alive(true).build(connector),
session: Mutex::new(session),
})))
}))
}
}