tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 788HTML 740Markdown 12TOML 62536 Definiciones

No longer depend on lazy_static

e77578c02cfdfb9f5833bcbf7e180d426ca2e8d1 · por David Flemström · (hace 6 años) · padre 983fb67d3 · ver el árbol en este commit

Delta semántico · 2

src/id.rs

  • cambió de firma fn new pub

src/node.rs

4 archivos · +3 −9

diff --git a/Cargo.toml b/Cargo.toml
index 88911be15..0ea6df007 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -20,7 +20,6 @@ arrayvec = "0.5.1"
 hash32 = "0.1.1"
 hash32-derive = "0.1.0"
 heapless = "0.5.1"
-lazy_static = "1.4"
 typenum = "1.11.2"
 
 [dependencies.hashbrown]
diff --git a/src/id.rs b/src/id.rs
index 3ff433841..4e2586312 100644
--- a/src/id.rs
+++ b/src/id.rs
@@ -15,7 +15,7 @@ pub(crate) struct Allocator {
 }
 
 impl Allocator {
-    pub fn new() -> Self {
+    pub const fn new() -> Self {
         Allocator { new_id: atomic::AtomicU64::new(0) }
     }
 
diff --git a/src/lib.rs b/src/lib.rs
index 5ecab2f1c..482f36432 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -3,9 +3,6 @@
 #[cfg(all(not(feature = "std"), feature = "alloc"))]
 extern crate alloc;
 
-#[macro_use]
-extern crate lazy_static;
-
 #[cfg_attr(feature = "serde", macro_use)]
 #[cfg(feature = "serde")]
 extern crate serde;
diff --git a/src/node.rs b/src/node.rs
index 6a32d17a6..2516d451f 100644
--- a/src/node.rs
+++ b/src/node.rs
@@ -15,10 +15,8 @@ pub enum MeasureFunc {
     Boxed(sys::Box<dyn Fn(Size<Number>) -> Size<f32>>),
 }
 
-lazy_static! {
-    /// Global stretch instance id allocator.
-    static ref INSTANCE_ALLOCATOR: id::Allocator = id::Allocator::new();
-}
+/// Global stretch instance id allocator.
+static INSTANCE_ALLOCATOR: id::Allocator = id::Allocator::new();
 
 #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
 #[cfg_attr(not(any(feature = "std", feature = "alloc")), derive(hash32_derive::Hash32))]