diff --git a/Cargo.lock b/Cargo.lock index 1650a4c9af75..6df99b9b9cb4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6185,7 +6185,6 @@ dependencies = [ "bitflags 2.9.0", "cssparser", "euclid", - "lazy_static", "malloc_size_of", "malloc_size_of_derive", "nsstring", diff --git a/servo/components/style_traits/Cargo.toml b/servo/components/style_traits/Cargo.toml index 6e456c80e4d0..c267c3b6fd91 100644 --- a/servo/components/style_traits/Cargo.toml +++ b/servo/components/style_traits/Cargo.toml @@ -4,6 +4,7 @@ version = "0.0.1" authors = ["The Servo Project Developers"] license = "MPL-2.0" repository = "https://github.com/servo/stylo" +edition = "2021" publish = false [lib] @@ -19,7 +20,6 @@ app_units = "0.7" bitflags = "2" cssparser = "0.34" euclid = "0.22" -lazy_static = "1" malloc_size_of = { path = "../malloc_size_of" } malloc_size_of_derive = { path = "../../../xpcom/rust/malloc_size_of_derive" } nsstring = {path = "../../../xpcom/rust/nsstring/", optional = true} diff --git a/servo/components/style_traits/arc_slice.rs b/servo/components/style_traits/arc_slice.rs index 5b1157277130..2429e81d175a 100644 --- a/servo/components/style_traits/arc_slice.rs +++ b/servo/components/style_traits/arc_slice.rs @@ -9,6 +9,7 @@ use serde::ser::{Serialize, Serializer}; use servo_arc::ThinArc; use std::ops::Deref; use std::ptr::NonNull; +use std::sync::LazyLock; use std::{iter, mem, hash::{Hash, Hasher}}; use malloc_size_of::{MallocSizeOf, MallocSizeOfOps, MallocUnconditionalSizeOf}; @@ -44,12 +45,9 @@ impl Clone for ArcSlice { } } -lazy_static! { - // ThinArc doesn't support alignments greater than align_of::. - static ref EMPTY_ARC_SLICE: ArcSlice = { - ArcSlice::from_iter_leaked(iter::empty()) - }; -} +// ThinArc doesn't support alignments greater than align_of::. +static EMPTY_ARC_SLICE: LazyLock> = + LazyLock::new(|| ArcSlice::from_iter_leaked(iter::empty())); impl Default for ArcSlice { #[allow(unsafe_code)] diff --git a/servo/components/style_traits/lib.rs b/servo/components/style_traits/lib.rs index 59f8c9256029..bc57d9f48983 100644 --- a/servo/components/style_traits/lib.rs +++ b/servo/components/style_traits/lib.rs @@ -10,31 +10,16 @@ #![crate_type = "rlib"] #![deny(unsafe_code, missing_docs)] -extern crate app_units; -#[macro_use] -extern crate bitflags; -extern crate cssparser; -extern crate euclid; -#[macro_use] -extern crate lazy_static; -extern crate malloc_size_of; #[macro_use] extern crate malloc_size_of_derive; -#[cfg(feature = "gecko")] -extern crate nsstring; -extern crate selectors; #[macro_use] extern crate serde; -extern crate servo_arc; -#[cfg(feature = "servo")] -extern crate servo_atoms; -extern crate thin_vec; -extern crate to_shmem; #[macro_use] extern crate to_shmem_derive; #[cfg(feature = "servo")] - extern crate url; +extern crate url; +use bitflags::bitflags; use cssparser::{CowRcStr, Token}; use selectors::parser::SelectorParseErrorKind; #[cfg(feature = "servo")]