From 34f4fbe4bc04bbd85cf21e9aaf9b1278ce4d9166 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Wed, 16 Feb 2022 13:35:15 -0700 Subject: [PATCH 1/3] Remove dependency on third-party matches crate Now that the MSRV is 1.45, this macro can be assumed to exist, since it was introduced in 1.42. --- data-url/Cargo.toml | 3 --- data-url/src/lib.rs | 3 --- form_urlencoded/Cargo.toml | 1 - form_urlencoded/src/lib.rs | 3 --- idna/Cargo.toml | 1 - idna/src/lib.rs | 3 ++- url/Cargo.toml | 1 - url/src/lib.rs | 2 -- 8 files changed, 2 insertions(+), 15 deletions(-) diff --git a/data-url/Cargo.toml b/data-url/Cargo.toml index 78145c4a7..6765f4511 100644 --- a/data-url/Cargo.toml +++ b/data-url/Cargo.toml @@ -9,9 +9,6 @@ edition = "2018" autotests = false rust-version = "1.45" -[dependencies] -matches = "0.1" - [dev-dependencies] tester = "0.9" serde = {version = "1.0", features = ["derive"]} diff --git a/data-url/src/lib.rs b/data-url/src/lib.rs index 40f6e34fa..4a4f376f4 100644 --- a/data-url/src/lib.rs +++ b/data-url/src/lib.rs @@ -15,9 +15,6 @@ //! assert!(fragment.is_none()); //! ``` -#[macro_use] -extern crate matches; - macro_rules! require { ($condition: expr) => { if !$condition { diff --git a/form_urlencoded/Cargo.toml b/form_urlencoded/Cargo.toml index 190ab52b0..c778d2d04 100644 --- a/form_urlencoded/Cargo.toml +++ b/form_urlencoded/Cargo.toml @@ -12,5 +12,4 @@ rust-version = "1.45" test = false [dependencies] -matches = "0.1" percent-encoding = { version = "2.1.0", path = "../percent_encoding" } diff --git a/form_urlencoded/src/lib.rs b/form_urlencoded/src/lib.rs index 765ee168a..b0916e42b 100644 --- a/form_urlencoded/src/lib.rs +++ b/form_urlencoded/src/lib.rs @@ -13,9 +13,6 @@ //! Converts between a string (such as an URL’s query string) //! and a sequence of (name, value) pairs. -#[macro_use] -extern crate matches; - use percent_encoding::{percent_decode, percent_encode_byte}; use std::borrow::{Borrow, Cow}; use std::str; diff --git a/idna/Cargo.toml b/idna/Cargo.toml index 31b08302e..9566cc72e 100644 --- a/idna/Cargo.toml +++ b/idna/Cargo.toml @@ -28,7 +28,6 @@ serde_json = "1.0" [dependencies] unicode-bidi = "0.3" unicode-normalization = "0.1.17" -matches = "0.1" [[bench]] name = "all" diff --git a/idna/src/lib.rs b/idna/src/lib.rs index b87d4a15e..37d638741 100644 --- a/idna/src/lib.rs +++ b/idna/src/lib.rs @@ -32,8 +32,9 @@ //! > that minimizes the impact of this transition for client software, //! > allowing client software to access domains that are valid under either system. +#[cfg(test)] #[macro_use] -extern crate matches; +extern crate assert_matches; pub mod punycode; mod uts46; diff --git a/url/Cargo.toml b/url/Cargo.toml index 16fbabe8d..3955078b5 100644 --- a/url/Cargo.toml +++ b/url/Cargo.toml @@ -27,7 +27,6 @@ bencher = "0.1" [dependencies] form_urlencoded = { version = "1.0.0", path = "../form_urlencoded" } idna = { version = "0.2.0", path = "../idna", optional = true } -matches = "0.1" percent-encoding = { version = "2.1.0", path = "../percent_encoding" } serde = {version = "1.0", optional = true, features = ["derive"]} diff --git a/url/src/lib.rs b/url/src/lib.rs index 3e580082d..8bdd378b7 100644 --- a/url/src/lib.rs +++ b/url/src/lib.rs @@ -132,8 +132,6 @@ url = { version = "2", default-features = false } #![doc(html_root_url = "https://docs.rs/url/2.2.2")] -#[macro_use] -extern crate matches; pub use form_urlencoded; #[cfg(feature = "serde")] From 033ba91a784345184cca52dfaf0013f33edffc33 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Wed, 16 Feb 2022 13:50:19 -0700 Subject: [PATCH 2/3] Fix pattern syntax for rustc 1.45 --- url/src/host.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/url/src/host.rs b/url/src/host.rs index a69d8c97d..ad5b755d2 100644 --- a/url/src/host.rs +++ b/url/src/host.rs @@ -90,7 +90,7 @@ impl Host { } let is_invalid_domain_char = |c| { - matches!(c, |'\0'..='\u{001F}'| ' ' + matches!(c, '\0'..='\u{001F}'| ' ' | '#' | '%' | '/' From fd62d12d9d12e9462f7d8de36763bfc91da5f3f3 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Wed, 16 Feb 2022 13:54:47 -0700 Subject: [PATCH 3/3] Fix formatting --- url/src/host.rs | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/url/src/host.rs b/url/src/host.rs index ad5b755d2..4678cb8a1 100644 --- a/url/src/host.rs +++ b/url/src/host.rs @@ -90,21 +90,25 @@ impl Host { } let is_invalid_domain_char = |c| { - matches!(c, '\0'..='\u{001F}'| ' ' - | '#' - | '%' - | '/' - | ':' - | '<' - | '>' - | '?' - | '@' - | '[' - | '\\' - | ']' - | '^' - | '\u{007F}' - | '|') + matches!( + c, + '\0'..='\u{001F}' + | ' ' + | '#' + | '%' + | '/' + | ':' + | '<' + | '>' + | '?' + | '@' + | '[' + | '\\' + | ']' + | '^' + | '\u{007F}' + | '|' + ) }; if domain.find(is_invalid_domain_char).is_some() {