From 7e67e10bc473311602e5d9704c7ceaa96bdb2581 Mon Sep 17 00:00:00 2001 From: leo60228 Date: Thu, 28 May 2020 09:54:19 -0400 Subject: [PATCH] Remove url 2.x I thought tungstenite needed it, but it doesn't. --- Cargo.toml | 3 +-- src/errors.rs | 5 ----- src/lib.rs | 7 +++---- src/page.rs | 2 +- src/registration.rs | 2 +- 5 files changed, 6 insertions(+), 13 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4f03ffb..6a549ba 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,6 +18,7 @@ serde_derive = "1" serde_json = "1" serde_urlencoded = "0.6.1" serde_qs = "0.4.5" +url = "1" tap-reader = "1" try_from = "0.3.2" toml = { version = "0.5.0", optional = true } @@ -25,8 +26,6 @@ hyper-old-types = "0.11.0" envy = { version = "0.4.0", optional = true } log = "0.4.6" tungstenite = "0.10.1" -url = "2.1.1" -url1x = { version = "1", package = "url" } [dependencies.chrono] version = "0.4" diff --git a/src/errors.rs b/src/errors.rs index 65e5fcc..f4d62b4 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -12,7 +12,6 @@ use tomlcrate::de::Error as TomlDeError; #[cfg(feature = "toml")] use tomlcrate::ser::Error as TomlSerError; use url::ParseError as UrlError; -use url1x::ParseError as ReqwestUrlError; use tungstenite::error::Error as WebSocketError; /// Convience type over `std::result::Result` with `Error` as the error type. @@ -35,8 +34,6 @@ pub enum Error { Io(IoError), /// Wrapper around the `url::ParseError` struct. Url(UrlError), - /// Wrapper around the `url::ParseError` struct. - ReqwestUrl(ReqwestUrlError), /// Missing Client Id. ClientIdRequired, /// Missing Client Secret. @@ -85,7 +82,6 @@ impl error::Error for Error { Error::Http(ref e) => e, Error::Io(ref e) => e, Error::Url(ref e) => e, - Error::ReqwestUrl(ref e) => e, #[cfg(feature = "toml")] Error::TomlSer(ref e) => e, #[cfg(feature = "toml")] @@ -146,7 +142,6 @@ from! { SerdeError, Serde, UrlEncodedError, UrlEncoded, UrlError, Url, - ReqwestUrlError, ReqwestUrl, ApiError, Api, #[cfg(feature = "toml")] TomlSerError, TomlSer, #[cfg(feature = "toml")] TomlDeError, TomlDe, diff --git a/src/lib.rs b/src/lib.rs index b82099c..7dccb5f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -89,7 +89,6 @@ extern crate serde_urlencoded; extern crate tap_reader; extern crate try_from; extern crate url; -extern crate url1x; extern crate tungstenite; #[cfg(feature = "env")] @@ -776,7 +775,7 @@ impl MastodonBuilder { pub struct MastodonUnauth { client: Client, http_sender: H, - base: reqwest::Url, + base: url::Url, } impl MastodonUnauth { @@ -790,13 +789,13 @@ impl MastodonUnauth { Ok(MastodonUnauth { client: Client::new(), http_sender: HttpSender, - base: reqwest::Url::parse(&base)?, + base: url::Url::parse(&base)?, }) } } impl MastodonUnauth { - fn route(&self, url: &str) -> Result { + fn route(&self, url: &str) -> Result { Ok(self.base.join(url)?) } diff --git a/src/page.rs b/src/page.rs index 09a2dca..3a47ce6 100644 --- a/src/page.rs +++ b/src/page.rs @@ -3,7 +3,7 @@ use entities::itemsiter::ItemsIter; use hyper_old_types::header::{parsing, Link, RelationType}; use reqwest::{header::LINK, Response}; use serde::Deserialize; -use reqwest::Url; +use url::Url; use http_send::HttpSend; diff --git a/src/registration.rs b/src/registration.rs index 8417b40..7aba7c5 100644 --- a/src/registration.rs +++ b/src/registration.rs @@ -2,7 +2,7 @@ use std::borrow::Cow; use reqwest::{Client, RequestBuilder, Response}; use try_from::TryInto; -use url1x::percent_encoding::{utf8_percent_encode, DEFAULT_ENCODE_SET}; +use url::percent_encoding::{utf8_percent_encode, DEFAULT_ENCODE_SET}; use apps::{App, AppBuilder}; use http_send::{HttpSend, HttpSender};