diff --git a/Cargo.lock b/Cargo.lock index d3535ead8b86..fad9b798a8b3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -358,7 +358,6 @@ dependencies = [ "ahash", "hashbrown", "indexmap", - "lazy_static", "ndarray", "num-bigint", "num-complex", diff --git a/Cargo.toml b/Cargo.toml index 55022c907572..673f8d56a09d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,6 @@ indexmap = "1.9.1" ahash = "0.7.6" num-complex = "0.4" num-bigint = "0.4" -lazy_static = "1.4.0" [dependencies.pyo3] version = "0.16.5" diff --git a/src/lib.rs b/src/lib.rs index a719f0437fa3..36aba5f946d0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,9 +10,6 @@ // copyright notice, and modified files need to carry a notice indicating // that they have been altered from the originals. -#[macro_use] -extern crate lazy_static; - use std::env; use pyo3::prelude::*; diff --git a/src/results/converters.rs b/src/results/converters.rs index c6d68ae0d991..89889c70d244 100644 --- a/src/results/converters.rs +++ b/src/results/converters.rs @@ -10,35 +10,35 @@ // copyright notice, and modified files need to carry a notice indicating // that they have been altered from the originals. -lazy_static! { - static ref HEX_TO_BIN_LUT: [&'static str; 256] = { - let mut lookup = [""; 256]; - lookup[b'0' as usize] = "0000"; - lookup[b'1' as usize] = "0001"; - lookup[b'2' as usize] = "0010"; - lookup[b'3' as usize] = "0011"; - lookup[b'4' as usize] = "0100"; - lookup[b'5' as usize] = "0101"; - lookup[b'6' as usize] = "0110"; - lookup[b'7' as usize] = "0111"; - lookup[b'8' as usize] = "1000"; - lookup[b'9' as usize] = "1001"; - lookup[b'A' as usize] = "1010"; - lookup[b'B' as usize] = "1011"; - lookup[b'C' as usize] = "1100"; - lookup[b'D' as usize] = "1101"; - lookup[b'E' as usize] = "1110"; - lookup[b'F' as usize] = "1111"; - lookup[b'a' as usize] = "1010"; - lookup[b'b' as usize] = "1011"; - lookup[b'c' as usize] = "1100"; - lookup[b'd' as usize] = "1101"; - lookup[b'e' as usize] = "1110"; - lookup[b'f' as usize] = "1111"; - lookup - }; +const fn generate_lookup_table() -> [&'static str; 103] { + let mut lookup = [""; 103]; + lookup[b'0' as usize] = "0000"; + lookup[b'1' as usize] = "0001"; + lookup[b'2' as usize] = "0010"; + lookup[b'3' as usize] = "0011"; + lookup[b'4' as usize] = "0100"; + lookup[b'5' as usize] = "0101"; + lookup[b'6' as usize] = "0110"; + lookup[b'7' as usize] = "0111"; + lookup[b'8' as usize] = "1000"; + lookup[b'9' as usize] = "1001"; + lookup[b'A' as usize] = "1010"; + lookup[b'B' as usize] = "1011"; + lookup[b'C' as usize] = "1100"; + lookup[b'D' as usize] = "1101"; + lookup[b'E' as usize] = "1110"; + lookup[b'F' as usize] = "1111"; + lookup[b'a' as usize] = "1010"; + lookup[b'b' as usize] = "1011"; + lookup[b'c' as usize] = "1100"; + lookup[b'd' as usize] = "1101"; + lookup[b'e' as usize] = "1110"; + lookup[b'f' as usize] = "1111"; + lookup } +static HEX_TO_BIN_LUT: [&str; 103] = generate_lookup_table(); + #[inline] pub fn hex_to_bin(hex: &str) -> String { hex[2..]