From 898e045583238d2ddaa4947e910260822ebe7cab Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Tue, 30 Sep 2025 15:17:28 -0400 Subject: [PATCH 1/5] update ada to v3.3.0 --- deps/ada.cpp | 27 +++++++++++++++++++++++---- deps/ada.h | 11 ++++++----- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/deps/ada.cpp b/deps/ada.cpp index 16e3fe2..72f0e31 100644 --- a/deps/ada.cpp +++ b/deps/ada.cpp @@ -1,4 +1,4 @@ -/* auto-generated on 2025-07-16 22:15:14 -0400. Do not edit! */ +/* auto-generated on 2025-09-23 12:57:35 -0400. Do not edit! */ /* begin file src/ada.cpp */ #include "ada.h" /* begin file src/checkers.cpp */ @@ -9511,12 +9511,14 @@ bool is_label_valid(const std::u32string_view label) { for (size_t i = 0; i <= last_non_nsm_char; i++) { const direction d = find_direction(label[i]); + // NOLINTBEGIN(bugprone-assignment-in-if-condition) // In an RTL label, if an EN is present, no AN may be present, and vice // versa. if ((d == direction::EN && ((has_en = true) && has_an)) || (d == direction::AN && ((has_an = true) && has_en))) { return false; } + // NOLINTEND(bugprone-assignment-in-if-condition) if (!(d == direction::R || d == direction::AL || d == direction::AN || d == direction::EN || d == direction::ES || d == direction::CS || @@ -10908,6 +10910,7 @@ bool percent_encode(const std::string_view input, const uint8_t character_set[], } ada_log("percent_encode appending ", std::distance(input.begin(), pointer), " bytes"); + // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage) out.append(input.data(), std::distance(input.begin(), pointer)); ada_log("percent_encode processing ", std::distance(pointer, input.end()), " bytes"); @@ -10942,6 +10945,7 @@ bool to_ascii(std::optional& out, const std::string_view plain, std::string percent_encode(const std::string_view input, const uint8_t character_set[], size_t index) { std::string out; + // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage) out.append(input.data(), index); auto pointer = input.begin() + index; for (; pointer != input.end(); pointer++) { @@ -12008,6 +12012,7 @@ ada_warn_unused std::string to_string(ada::state state) { #include #include +#include #include #include #include @@ -12570,6 +12575,7 @@ ada_really_inline void url::parse_path(std::string_view input) { if (has_search()) { answer.append(",\n"); answer.append("\t\"query\":\""); + // NOLINTNEXTLINE(bugprone-unchecked-optional-access) helpers::encode_json(query.value(), back); answer.append("\""); } @@ -13316,6 +13322,7 @@ result_type parse_url_impl(std::string_view user_input, // If c is U+002F (/), then set state to relative slash state. if ((input_position != input_size) && + // NOLINTNEXTLINE(bugprone-branch-clone) (url_data[input_position] == '/')) { ada_log( "RELATIVE_SCHEME if c is U+002F (/), then set state to relative " @@ -13848,6 +13855,7 @@ template url_aggregator parse_url( /* end file src/parser.cpp */ /* begin file src/url_components.cpp */ +#include #include namespace ada { @@ -13897,6 +13905,7 @@ namespace ada { /* end file src/url_components.cpp */ /* begin file src/url_aggregator.cpp */ +#include #include #include #include @@ -15832,7 +15841,11 @@ tl::expected url_pattern_init::process_search( if (value.starts_with("?")) { value.remove_prefix(1); } - ADA_ASSERT_TRUE(!value.starts_with("?")); + // We cannot assert that the value is no longer starting with a single + // question mark because technically it can start. The question is whether or + // not we should remove the first question mark. Ref: + // https://github.com/ada-url/ada/pull/992 The spec is not clear on this. + // If type is "pattern" then return strippedValue. if (type == process_type::pattern) { return std::string(value); @@ -16273,7 +16286,10 @@ tl::expected canonicalize_search(std::string_view input) { url->set_search(input); if (url->has_search()) { const auto search = url->get_search(); - return std::string(search.substr(1)); + if (!search.empty()) { + return std::string(search.substr(1)); + } + return ""; } return tl::unexpected(errors::type_error); } @@ -16293,7 +16309,10 @@ tl::expected canonicalize_hash(std::string_view input) { // Return dummyURL's fragment. if (url->has_hash()) { const auto hash = url->get_hash(); - return std::string(hash.substr(1)); + if (!hash.empty()) { + return std::string(hash.substr(1)); + } + return ""; } return tl::unexpected(errors::type_error); } diff --git a/deps/ada.h b/deps/ada.h index e0be62f..db2803c 100644 --- a/deps/ada.h +++ b/deps/ada.h @@ -1,4 +1,4 @@ -/* auto-generated on 2025-07-16 22:15:14 -0400. Do not edit! */ +/* auto-generated on 2025-09-23 12:57:35 -0400. Do not edit! */ /* begin file include/ada.h */ /** * @file ada.h @@ -947,7 +947,7 @@ constexpr uint8_t WWW_FORM_URLENCODED_PERCENT_ENCODE[32] = { // 50 51 52 53 54 55 56 57 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, // 58 59 5A 5B 5C 5D 5E 5F - 0x00 | 0x00 | 0x00 | 0x08 | 0x00 | 0x20 | 0x40 | 0x00, + 0x00 | 0x00 | 0x00 | 0x08 | 0x10 | 0x20 | 0x40 | 0x00, // 60 61 62 63 64 65 66 67 0x01 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, // 68 69 6A 6B 6C 6D 6E 6F @@ -6641,6 +6641,7 @@ inline std::ostream &operator<<(std::ostream &out, const ada::url &u) { out.protocol_end = uint32_t(get_protocol().size()); // Trailing index is always the next character of the current one. + // NOLINTNEXTLINE(clang-analyzer-deadcode.DeadStores) size_t running_index = out.protocol_end; if (host.has_value()) { @@ -10514,14 +10515,14 @@ constructor_string_parser::parse(std::string_view input) { #ifndef ADA_ADA_VERSION_H #define ADA_ADA_VERSION_H -#define ADA_VERSION "3.2.6" +#define ADA_VERSION "3.3.0" namespace ada { enum { ADA_VERSION_MAJOR = 3, - ADA_VERSION_MINOR = 2, - ADA_VERSION_REVISION = 6, + ADA_VERSION_MINOR = 3, + ADA_VERSION_REVISION = 0, }; } // namespace ada From 9fd6d27a7e2f08cb5cad63d82b36e7521993ece7 Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Tue, 30 Sep 2025 15:19:11 -0400 Subject: [PATCH 2/5] remove derive_more dependency --- Cargo.lock | 44 -------------------------------------------- Cargo.toml | 1 - src/lib.rs | 15 ++++++++++----- 3 files changed, 10 insertions(+), 50 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 005b58c..2f49197 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,7 +8,6 @@ version = "3.2.6" dependencies = [ "cc", "criterion", - "derive_more", "link_args", "regex", "serde", @@ -124,15 +123,6 @@ version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675" -[[package]] -name = "convert_case" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" -dependencies = [ - "unicode-segmentation", -] - [[package]] name = "criterion" version = "0.5.1" @@ -173,28 +163,6 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" -[[package]] -name = "derive_more" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a9b99b9cbbe49445b21764dc0625032a89b145a2642e67603e1c936f5458d05" -dependencies = [ - "derive_more-impl", -] - -[[package]] -name = "derive_more-impl" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" -dependencies = [ - "convert_case", - "proc-macro2", - "quote", - "syn", - "unicode-xid", -] - [[package]] name = "displaydoc" version = "0.2.5" @@ -618,18 +586,6 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" -[[package]] -name = "unicode-segmentation" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" - -[[package]] -name = "unicode-xid" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" - [[package]] name = "url" version = "2.5.4" diff --git a/Cargo.toml b/Cargo.toml index f8771f4..4e8d91d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,7 +32,6 @@ serde = ["dep:serde", "std"] std = [] [dependencies] -derive_more = { version = "1", features = ["full"] } serde = { version = "1", optional = true, features = ["derive"] } [dev-dependencies] diff --git a/src/lib.rs b/src/lib.rs index ccee23f..9eab7cd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -58,18 +58,23 @@ extern crate std; use std::string::String; use core::{borrow, ffi::c_uint, fmt, hash, ops}; -use derive_more::Display; /// Error type of [`Url::parse`]. -#[derive(Debug, Display, PartialEq, Eq)] -#[cfg_attr(feature = "std", derive(derive_more::Error))] // error still requires std: https://github.com/rust-lang/rust/issues/103765 -#[display(bound(Input: core::fmt::Debug))] -#[display("Invalid url: {input:?}")] +#[derive(Debug, PartialEq, Eq)] pub struct ParseUrlError { /// The invalid input that caused the error. pub input: Input, } +impl fmt::Display for ParseUrlError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "Invalid url: {:?}", self.input) + } +} + +#[cfg(feature = "std")] // error still requires std: https://github.com/rust-lang/rust/issues/103765 +impl std::error::Error for ParseUrlError {} + /// Defines the type of the host. #[derive(Debug, Clone, PartialEq, Eq)] pub enum HostType { From 5d24b4db2c28549a2ffa613f2900226c62d34ac4 Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Tue, 30 Sep 2025 15:19:49 -0400 Subject: [PATCH 3/5] update rust to v1.90.0 --- rust-toolchain.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 4bd1ff4..2ce412d 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "1.86.0" +channel = "1.90.0" profile = "default" From 5404eb019f90f50c7946ee9856473f35e430ba01 Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Tue, 30 Sep 2025 15:23:05 -0400 Subject: [PATCH 4/5] fix clippy errors --- src/url_search_params.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/url_search_params.rs b/src/url_search_params.rs index 40e0b8b..40e33b2 100644 --- a/src/url_search_params.rs +++ b/src/url_search_params.rs @@ -182,7 +182,7 @@ impl UrlSearchParams { /// let pairs = params.get_all("a"); /// assert_eq!(pairs.len(), 2); /// ``` - pub fn get_all(&self, key: &str) -> UrlSearchParamsEntry { + pub fn get_all(&self, key: &str) -> UrlSearchParamsEntry<'_> { unsafe { let strings = ffi::ada_search_params_get_all(self.0, key.as_ptr().cast(), key.len()); let size = ffi::ada_strings_size(strings); @@ -198,7 +198,7 @@ impl UrlSearchParams { /// .expect("String should have been able to be parsed into an UrlSearchParams."); /// let mut keys = params.keys(); /// assert!(keys.next().is_some()); - pub fn keys(&self) -> UrlSearchParamsKeyIterator { + pub fn keys(&self) -> UrlSearchParamsKeyIterator<'_> { let iterator = unsafe { ffi::ada_search_params_get_keys(self.0) }; UrlSearchParamsKeyIterator::new(iterator) } @@ -211,7 +211,7 @@ impl UrlSearchParams { /// .expect("String should have been able to be parsed into an UrlSearchParams."); /// let mut values = params.values(); /// assert!(values.next().is_some()); - pub fn values(&self) -> UrlSearchParamsValueIterator { + pub fn values(&self) -> UrlSearchParamsValueIterator<'_> { let iterator = unsafe { ffi::ada_search_params_get_values(self.0) }; UrlSearchParamsValueIterator::new(iterator) } @@ -225,7 +225,7 @@ impl UrlSearchParams { /// let mut entries = params.entries(); /// assert_eq!(entries.next(), Some(("a", "1"))); /// ``` - pub fn entries(&self) -> UrlSearchParamsEntryIterator { + pub fn entries(&self) -> UrlSearchParamsEntryIterator<'_> { let iterator = unsafe { ffi::ada_search_params_get_entries(self.0) }; UrlSearchParamsEntryIterator::new(iterator) } From fdedc81685230d6d656c5c10a177457e75efaa82 Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Tue, 30 Sep 2025 15:26:11 -0400 Subject: [PATCH 5/5] release v3.3.0 --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2f49197..8f1f3f6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,7 +4,7 @@ version = 4 [[package]] name = "ada-url" -version = "3.2.6" +version = "3.3.0" dependencies = [ "cc", "criterion", diff --git a/Cargo.toml b/Cargo.toml index 4e8d91d..fca2773 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ authors = [ "LongYinan ", "Boshen " ] -version = "3.2.6" +version = "3.3.0" edition = "2024" description = "Fast WHATWG Compliant URL parser" documentation = "https://docs.rs/ada-url"