From 5df9ae350c30e89d7b2116c7750ec051395e21ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Thu, 6 May 2021 09:58:21 +0200 Subject: [PATCH] client: Require a proper Url to create a client --- matrix_sdk/src/client.rs | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/matrix_sdk/src/client.rs b/matrix_sdk/src/client.rs index ada6ced0..477c7473 100644 --- a/matrix_sdk/src/client.rs +++ b/matrix_sdk/src/client.rs @@ -22,7 +22,6 @@ use std::{ ops::Range, }; use std::{ - convert::TryInto, fmt::{self, Debug}, future::Future, io::Read, @@ -477,7 +476,7 @@ impl Client { /// # Arguments /// /// * `homeserver_url` - The homeserver that the client should connect to. - pub fn new(homeserver_url: impl TryInto) -> Result { + pub fn new(homeserver_url: Url) -> Result { let config = ClientConfig::new(); Client::new_with_config(homeserver_url, config) } @@ -489,15 +488,8 @@ impl Client { /// * `homeserver_url` - The homeserver that the client should connect to. /// /// * `config` - Configuration for the client. - pub fn new_with_config( - homeserver_url: impl TryInto, - config: ClientConfig, - ) -> Result { - let homeserver = if let Ok(u) = homeserver_url.try_into() { - Arc::new(u) - } else { - panic!("Error parsing homeserver url") - }; + pub fn new_with_config(homeserver_url: Url, config: ClientConfig) -> Result { + let homeserver = Arc::new(homeserver_url); let client = if let Some(client) = config.client { client