From 6c9946fd167324f7964df35c7b7bdf928a87b632 Mon Sep 17 00:00:00 2001 From: Philipp Rehner <69816385+prehner@users.noreply.github.com> Date: Wed, 8 Jan 2025 13:48:00 +0100 Subject: [PATCH] Remove lazy_static dependency (#268) --- Cargo.toml | 3 +-- src/uvtheory/parameters.rs | 10 +++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ce9df0015..0df22a04c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,7 +43,6 @@ conv = "0.3" num-traits = "0.2" serde = "1.0" serde_json = "1.0" -lazy_static = { version = "1.4", optional = true } indexmap = "2.0" rayon = { version = "1.7", optional = true } itertools = "0.14" @@ -76,7 +75,7 @@ association = [] pcsaft = ["association"] epcsaft = ["association"] gc_pcsaft = ["association"] -uvtheory = ["lazy_static"] +uvtheory = [] pets = [] saftvrqmie = [] saftvrmie = [] diff --git a/src/uvtheory/parameters.rs b/src/uvtheory/parameters.rs index d0509a9bf..7bdfc0ff5 100644 --- a/src/uvtheory/parameters.rs +++ b/src/uvtheory/parameters.rs @@ -1,6 +1,5 @@ use feos_core::parameter::{Identifier, ParameterError}; use feos_core::parameter::{Parameter, PureRecord}; -use lazy_static::lazy_static; use ndarray::concatenate; use ndarray::prelude::*; use ndarray::Array2; @@ -9,6 +8,7 @@ use serde::{Deserialize, Serialize}; use std::collections::HashMap; use std::fmt; use std::fmt::Write; +use std::sync::LazyLock; #[derive(Debug, Clone, Serialize, Deserialize, Default)] pub struct NoRecord; @@ -74,9 +74,9 @@ impl std::fmt::Display for UVTheoryBinaryRecord { } } -lazy_static! { /// Constants for BH temperature dependent HS diameter. - static ref CD_BH: Array2 = arr2(&[ +static CD_BH: LazyLock> = LazyLock::new(|| { + arr2(&[ [0.0, 1.09360455168912E-02, 0.0], [-2.00897880971934E-01, -1.27074910870683E-02, 0.0], [ @@ -89,8 +89,8 @@ lazy_static! { 5.05384813757953E-03, 4.91003312452622E-02, ], - ]); -} + ]) +}); #[inline] pub fn mie_prefactor + Copy>(rep: D, att: D) -> D {