From 4d35b69ffe3ca6d84a8371581c4c44cb3f098895 Mon Sep 17 00:00:00 2001 From: Narfinger Date: Thu, 26 Jun 2025 13:56:48 +0200 Subject: [PATCH] =?UTF-8?q?Clean=20up=20unused=20dependencies=20/=C2=A0fea?= =?UTF-8?q?tures=20and=20centralize=20more=20feature=20selection=20into=20?= =?UTF-8?q?root=20`Cargo.toml`=20(#37720)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Make feature flag of smallvec global. - Removed unused dependency of thinvec. - Removed unused flag of hyper-util. Reduces the binary size by an astonishing 3.352k. Testing: Compilation 'tests' this change. Signed-off-by: Narfinger --- Cargo.lock | 1 - Cargo.toml | 5 ++--- components/fonts/Cargo.toml | 2 +- components/malloc_size_of/Cargo.toml | 1 - components/malloc_size_of/lib.rs | 25 ------------------------- components/script/Cargo.toml | 2 +- 6 files changed, 4 insertions(+), 32 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8536bdf7e30..a0f0924370e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7595,7 +7595,6 @@ dependencies = [ "stylo_dom", "stylo_malloc_size_of", "taffy", - "thin-vec", "tokio", "unicode-bidi", "unicode-script", diff --git a/Cargo.toml b/Cargo.toml index f5aa47584f0..344eb8ac72d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -76,7 +76,7 @@ http = "1.3" http-body-util = "0.1" hyper = "1.6" hyper-rustls = { version = "0.27", default-features = false, features = ["http1", "http2", "logging", "tls12", "webpki-tokio"] } -hyper-util = { version = "0.1", features = ["client", "client-legacy", "http2", "tokio"] } +hyper-util = { version = "0.1", features = ["client", "http2", "tokio"] } hyper_serde = { path = "components/hyper_serde" } icu_locid = "1.5.0" icu_segmenter = "1.5.0" @@ -130,7 +130,7 @@ servo-media-gstreamer = { git = "https://github.com/servo/media" } servo-tracing = { path = "components/servo_tracing" } servo_arc = { git = "https://github.com/servo/stylo", branch = "2025-06-03" } smallbitvec = "2.6.0" -smallvec = "1.15" +smallvec = { version = "1.15", features = ["union"] } static_assertions = "1.1" string_cache = "0.8" string_cache_codegen = "0.5" @@ -146,7 +146,6 @@ surfman = { git = "https://github.com/servo/surfman", rev = "f7688b4585f9e0b5d4b syn = { version = "2", default-features = false, features = ["clone-impls", "derive", "parsing"] } synstructure = "0.13" taffy = { version = "0.8.3", default-features = false, features = ["detailed_layout_info", "grid", "serde", "std"] } -thin-vec = "0.2.14" tikv-jemalloc-sys = "0.6.0" tikv-jemallocator = "0.6.0" time = { package = "time", version = "0.3", features = ["large-dates", "local-offset", "serde"] } diff --git a/components/fonts/Cargo.toml b/components/fonts/Cargo.toml index 876ae1e5e73..a161cb11d86 100644 --- a/components/fonts/Cargo.toml +++ b/components/fonts/Cargo.toml @@ -45,7 +45,7 @@ serde = { workspace = true } servo_arc = { workspace = true } servo_config = { path = "../config" } servo_url = { path = "../url" } -smallvec = { workspace = true, features = ["union"] } +smallvec = { workspace = true } stylo = { workspace = true } stylo_atoms = { workspace = true } tracing = { workspace = true, optional = true } diff --git a/components/malloc_size_of/Cargo.toml b/components/malloc_size_of/Cargo.toml index 2f1c3649ea8..de2266b3c00 100644 --- a/components/malloc_size_of/Cargo.toml +++ b/components/malloc_size_of/Cargo.toml @@ -32,7 +32,6 @@ stylo = { workspace = true } stylo_dom = { workspace = true } stylo_malloc_size_of = { workspace = true } taffy = { workspace = true } -thin-vec = { workspace = true } tokio = { workspace = true, features = ["sync"] } unicode-bidi = { workspace = true } unicode-script = { workspace = true } diff --git a/components/malloc_size_of/lib.rs b/components/malloc_size_of/lib.rs index b1d6a12d669..4ff0b2d2152 100644 --- a/components/malloc_size_of/lib.rs +++ b/components/malloc_size_of/lib.rs @@ -352,31 +352,6 @@ where } } -impl MallocShallowSizeOf for thin_vec::ThinVec { - fn shallow_size_of(&self, ops: &mut MallocSizeOfOps) -> usize { - if self.capacity() == 0 { - // If it's the singleton we might not be a heap pointer. - return 0; - } - - assert_eq!( - std::mem::size_of::(), - std::mem::size_of::<*const ()>() - ); - unsafe { ops.malloc_size_of(*(self as *const Self as *const *const ())) } - } -} - -impl MallocSizeOf for thin_vec::ThinVec { - fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize { - let mut n = self.shallow_size_of(ops); - for elem in self.iter() { - n += elem.size_of(ops); - } - n - } -} - impl MallocSizeOf for BinaryHeap { fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize { self.iter().map(|element| element.size_of(ops)).sum() diff --git a/components/script/Cargo.toml b/components/script/Cargo.toml index 127cf672845..0774fa6dffd 100644 --- a/components/script/Cargo.toml +++ b/components/script/Cargo.toml @@ -114,7 +114,7 @@ servo_config = { path = "../config" } servo_geometry = { path = "../geometry" } servo_rand = { path = "../rand" } servo_url = { path = "../url" } -smallvec = { workspace = true, features = ["union"] } +smallvec = { workspace = true } strum = { workspace = true } strum_macros = { workspace = true } stylo = { workspace = true }