tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit e33d186226374e6d24a85182171ae14a683afe40
parent bbeecfb159fb6174ffa7a912ba114c41af5fd762
Author: Nico Burns <nico@nicoburns.com>
Date:   Mon, 15 Dec 2025 19:03:58 +0000

Bug 2005254: Remove the matches dependency from the style crate (r=firefox-style-system-reviewers,sylvestre,dshin,emilio)

The Rust standard library now covers this functionality.

Differential Revision: https://phabricator.services.mozilla.com/D275847

Diffstat:
MCargo.lock | 7-------
Mservo/components/style/Cargo.toml | 1-
Mservo/components/style/lib.rs | 3---
Mservo/components/style/properties_and_values/value.rs | 2+-
Dthird_party/rust/matches/.cargo-checksum.json | 2--
Dthird_party/rust/matches/Cargo.toml | 23-----------------------
Dthird_party/rust/matches/LICENSE | 25-------------------------
Dthird_party/rust/matches/README.md | 7-------
Dthird_party/rust/matches/lib.rs | 161-------------------------------------------------------------------------------
Dthird_party/rust/matches/tests/macro_use_one.rs | 11-----------
Dthird_party/rust/matches/tests/use_star.rs | 10----------
Mtoolkit/content/license.html | 39---------------------------------------
12 files changed, 1 insertion(+), 290 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock @@ -4087,12 +4087,6 @@ dependencies = [ ] [[package]] -name = "matches" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" - -[[package]] name = "maybe-async" version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -6694,7 +6688,6 @@ dependencies = [ "log", "malloc_size_of", "malloc_size_of_derive", - "matches", "mozbuild", "new_debug_unreachable", "nsstring", diff --git a/servo/components/style/Cargo.toml b/servo/components/style/Cargo.toml @@ -70,7 +70,6 @@ log = "0.4" malloc_size_of = { path = "../malloc_size_of" } malloc_size_of_derive = { path = "../../../xpcom/rust/malloc_size_of_derive" } web_atoms = { version = "0.1", optional = true } -matches = "0.1" nsstring = {path = "../../../xpcom/rust/nsstring/", optional = true} num_cpus = {version = "1.1.0"} num-integer = "0.1" diff --git a/servo/components/style/lib.rs b/servo/components/style/lib.rs @@ -37,9 +37,6 @@ extern crate gecko_profiler; pub mod gecko_string_cache; #[macro_use] extern crate log; -#[allow(unused_extern_crates)] -#[macro_use] -extern crate matches; extern crate serde; pub use servo_arc; #[cfg(feature = "servo")] diff --git a/servo/components/style/properties_and_values/value.rs b/servo/components/style/properties_and_values/value.rs @@ -528,7 +528,7 @@ impl<'a> Parser<'a> { )), ); }; - debug_assert_matches!(multiplier, Multiplier::Space); + debug_assert_eq!(multiplier, Multiplier::Space); loop { values.push(SpecifiedValueComponent::TransformFunction( specified::Transform::parse(context, input)?, diff --git a/third_party/rust/matches/.cargo-checksum.json b/third_party/rust/matches/.cargo-checksum.json @@ -1 +0,0 @@ -{"files":{"Cargo.toml":"31b6fb9ee5ecddc429d13300336509fd7d199aa316375c00b581d60533b8ed43","LICENSE":"d7b49708075b5f43f8e108464f1970c8c66fa8b6afce4f9c944da3af77cc1460","README.md":"096bf8a54bac9e0fe42720d12aa40a2d3a6e78293c1bd8895f6bd9350a7fc224","lib.rs":"c6d14b7899277e45ac5f46d95f87c91ed0e5118db3b377e0914799d0e252650a","tests/macro_use_one.rs":"4f599fae16f1aef369050bf0ad74cbefec06c430b29e0c9ab0811ac9592e997a","tests/use_star.rs":"39a23b8002544f65e7a896e2cefe8e0af7404151fa65d327e748f5c1101badf8"},"package":"2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5"} -\ No newline at end of file diff --git a/third_party/rust/matches/Cargo.toml b/third_party/rust/matches/Cargo.toml @@ -1,23 +0,0 @@ -# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO -# -# When uploading crates to the registry Cargo will automatically -# "normalize" Cargo.toml files for maximal compatibility -# with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g., crates.io) dependencies. -# -# If you are reading this file be aware that the original Cargo.toml -# will likely look very different (and much more reasonable). -# See Cargo.toml.orig for the original contents. - -[package] -name = "matches" -version = "0.1.10" -description = "A macro to evaluate, as a boolean, whether an expression matches a pattern." -documentation = "https://docs.rs/matches/" -readme = "README.md" -license = "MIT" -repository = "https://github.com/SimonSapin/rust-std-candidates" - -[lib] -name = "matches" -path = "lib.rs" diff --git a/third_party/rust/matches/LICENSE b/third_party/rust/matches/LICENSE @@ -1,25 +0,0 @@ -Copyright (c) 2014-2016 Simon Sapin - -Permission is hereby granted, free of charge, to any -person obtaining a copy of this software and associated -documentation files (the "Software"), to deal in the -Software without restriction, including without -limitation the rights to use, copy, modify, merge, -publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice -shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF -ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED -TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. diff --git a/third_party/rust/matches/README.md b/third_party/rust/matches/README.md @@ -1,7 +0,0 @@ -A macro to evaluate, as a boolean, whether an expression matches a pattern. - -For users who build using only Rust 1.42 and newer, consider using [`std::matches`], which -is included in the [standard library prelude] and thus is automatically in scope. - -[`std::matches`]: core::matches -[standard library prelude]: https://doc.rust-lang.org/stable/reference/names/preludes.html diff --git a/third_party/rust/matches/lib.rs b/third_party/rust/matches/lib.rs @@ -1,161 +0,0 @@ -#![no_std] -//! A macro to evaluate, as a boolean, whether an expression matches a pattern. -//! -//! For users who build using only Rust 1.42 and newer, consider using [`std::matches`], which -//! is included in the [standard library prelude] and thus is automatically in scope. -//! -//! [`std::matches`]: core::matches -//! [standard library prelude]: https://doc.rust-lang.org/stable/reference/names/preludes.html -//! -//! # Examples -//! -//! ``` -//! #[macro_use] -//! extern crate matches; -//! -//! #[derive(Debug)] -//! pub enum Foo<T> { -//! A, -//! B(T), -//! } -//! -//! impl<T> Foo<T> { -//! pub fn is_b(&self) -> bool { -//! matches!(*self, Foo::B(_)) -//! } -//! } -//! -//! impl<T: core::fmt::Debug> Foo<T> { -//! pub fn assert_is_b(&self) { -//! assert_matches!(&self, Foo::B(_)); -//! } -//! } -//! # fn main() { } -//! ``` - -/// Check if an expression matches a refutable pattern. -/// -/// Syntax: `matches!(` *expression* `,` *pattern* `)` -/// -/// Return a boolean, true if the expression matches the pattern, false otherwise. -/// -/// # Examples -/// -/// ``` -/// #[macro_use] -/// extern crate matches; -/// -/// pub enum Foo<T> { -/// A, -/// B(T), -/// } -/// -/// impl<T> Foo<T> { -/// pub fn is_a(&self) -> bool { -/// matches!(*self, Foo::A) -/// } -/// -/// pub fn is_b(&self) -> bool { -/// matches!(*self, Foo::B(_)) -/// } -/// } -/// -/// # fn main() { } -/// ``` -#[macro_export] -macro_rules! matches { - ($expression:expr, $($pattern:tt)+) => { - match $expression { - $($pattern)+ => true, - _ => false - } - } -} - -/// Assert that an expression matches a refutable pattern. -/// -/// Syntax: `assert_matches!(` *expression* `,` *pattern* `)` -/// -/// Panic with a message that shows the expression if it does not match the -/// pattern. -/// -/// # Examples -/// -/// ``` -/// #[macro_use] -/// extern crate matches; -/// -/// fn main() { -/// let data = [1, 2, 3]; -/// assert_matches!(data.get(1), Some(_)); -/// } -/// ``` -#[macro_export] -macro_rules! assert_matches { - ($expression:expr, $($pattern:tt)+) => { - match $expression { - $($pattern)+ => (), - ref e => panic!("assertion failed: `{:?}` does not match `{}`", e, stringify!($($pattern)+)), - } - } -} - -/// Assert that an expression matches a refutable pattern using debug assertions. -/// -/// Syntax: `debug_assert_matches!(` *expression* `,` *pattern* `)` -/// -/// If debug assertions are enabled, panic with a message that shows the -/// expression if it does not match the pattern. -/// -/// When debug assertions are not enabled, this macro does nothing. -/// -/// # Examples -/// -/// ``` -/// #[macro_use] -/// extern crate matches; -/// -/// fn main() { -/// let data = [1, 2, 3]; -/// debug_assert_matches!(data.get(1), Some(_)); -/// } -/// ``` -#[macro_export] -macro_rules! debug_assert_matches { - ($expression:expr, $($pattern:tt)+) => { - if cfg!(debug_assertions) { - match $expression { - $($pattern)+ => (), - ref e => panic!("assertion failed: `{:?}` does not match `{}`", e, stringify!($($pattern)+)), - } - } - } -} - -#[test] -fn matches_works() { - let foo = Some("-12"); - assert!(matches!(foo, Some(bar) if - matches!(bar.as_bytes()[0], b'+' | b'-') && - matches!(bar.as_bytes()[1], b'0'...b'9') - )); -} - -#[test] -fn assert_matches_works() { - let foo = Some("-12"); - assert_matches!(foo, Some(bar) if - matches!(bar.as_bytes()[0], b'+' | b'-') && - matches!(bar.as_bytes()[1], b'0'...b'9') - ); -} - -#[test] -#[should_panic(expected = "assertion failed: `Some(\"-AB\")` does not match ")] -fn assert_matches_panics() { - let foo = Some("-AB"); - assert_matches!(foo, Some(bar) if - matches!(bar.as_bytes()[0], b'+' | b'-') && - matches!(bar.as_bytes()[1], b'0'...b'9') - ); -} diff --git a/third_party/rust/matches/tests/macro_use_one.rs b/third_party/rust/matches/tests/macro_use_one.rs @@ -1,11 +0,0 @@ -// https://github.com/SimonSapin/rust-std-candidates/issues/12 -#[macro_use(matches)] extern crate matches; - -#[test] -fn matches_works() { - let foo = Some("-12"); - assert!(matches!(foo, Some(bar) if - matches!(bar.as_bytes()[0], b'+' | b'-') && - matches!(bar.as_bytes()[1], b'0'...b'9') - )); -} diff --git a/third_party/rust/matches/tests/use_star.rs b/third_party/rust/matches/tests/use_star.rs @@ -1,10 +0,0 @@ -//! https://github.com/SimonSapin/rust-std-candidates/issues/22 - -extern crate matches; - -use matches::*; - -#[test] -fn test_assert_matches() { - assert_matches!(4, 4) -} diff --git a/toolkit/content/license.html b/toolkit/content/license.html @@ -116,7 +116,6 @@ <li><a href="about:license#libyuv">libyuv License</a></li> <li><a href="about:license#hunspell-lt">Lithuanian Spellchecking Dictionary License</a></li> <li><a href="about:license#lodash">lodash License</a></li> - <li><a href="about:license#matches">matches License</a></li> <li><a href="about:license#mit">MIT License</a></li> <li><a href="about:license#myspell">MySpell License</a></li> <li><a href="about:license#nicer">nICEr License</a></li> @@ -4081,44 +4080,6 @@ product. <tr> <td> - <h1><a id="matches"></a>matches License</h1> - </td> - <td> - <p>This license applies to files in the directory <code>third_party/rust/matches</code>.</p> - </td> - <td> - <pre> - Copyright (c) 2014-2016 Simon Sapin - - Permission is hereby granted, free of charge, to any - person obtaining a copy of this software and associated - documentation files (the "Software"), to deal in the - Software without restriction, including without - limitation the rights to use, copy, modify, merge, - publish, distribute, sublicense, and/or sell copies of - the Software, and to permit persons to whom the Software - is furnished to do so, subject to the following - conditions: - - The above copyright notice and this permission notice - shall be included in all copies or substantial portions - of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF - ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED - TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A - PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT - SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR - IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - </pre> - </td> - </tr> - - <tr> - <td> <h1><a id="mit"></a>MIT License</h1> </td> <td>