diff --git a/Cargo.lock b/Cargo.lock index f6a58522b7..c9f6617c0a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -358,7 +358,6 @@ name = "config" version = "0.1.0" dependencies = [ "errors", - "lazy_static", "libs", "serde", "utils", diff --git a/components/config/Cargo.toml b/components/config/Cargo.toml index 00f82e94d7..d7ef4029b6 100644 --- a/components/config/Cargo.toml +++ b/components/config/Cargo.toml @@ -6,8 +6,6 @@ include = ["src/**/*"] [dependencies] serde = {version = "1.0", features = ["derive"] } -# TODO: remove me if we can get highlight to work with once_cell -lazy_static = "1" errors = { path = "../errors" } utils = { path = "../utils" } diff --git a/components/config/src/highlighting.rs b/components/config/src/highlighting.rs index ece852942d..c51a74982e 100644 --- a/components/config/src/highlighting.rs +++ b/components/config/src/highlighting.rs @@ -1,23 +1,18 @@ -use lazy_static::lazy_static; use libs::syntect::dumps::from_binary; use libs::syntect::highlighting::{Theme, ThemeSet}; use libs::syntect::html::ClassStyle; use libs::syntect::parsing::{SyntaxReference, SyntaxSet}; +use libs::once_cell::sync::Lazy; use crate::config::Config; pub const CLASS_STYLE: ClassStyle = ClassStyle::SpacedPrefixed { prefix: "z-" }; -// TODO: replace with once_cell. I was getting malloc error with sync::Lazy -lazy_static! { - pub static ref SYNTAX_SET: SyntaxSet = { - let ss: SyntaxSet = - from_binary(include_bytes!("../../../sublime/syntaxes/newlines.packdump")); - ss - }; - pub static ref THEME_SET: ThemeSet = - from_binary(include_bytes!("../../../sublime/themes/all.themedump")); -} +pub static SYNTAX_SET: Lazy = + Lazy::new(|| from_binary(include_bytes!("../../../sublime/syntaxes/newlines.packdump"))); + +pub static THEME_SET: Lazy = + Lazy::new(|| from_binary(include_bytes!("../../../sublime/themes/all.themedump"))); #[derive(Clone, Debug, PartialEq, Eq)] pub enum HighlightSource {