Skip to content

Commit

Permalink
Remove last direct lazy_static usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Keats committed Jan 28, 2022
1 parent 6c2ae11 commit e2cdf00
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions components/config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
17 changes: 6 additions & 11 deletions components/config/src/highlighting.rs
Original file line number Diff line number Diff line change
@@ -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<SyntaxSet> =
Lazy::new(|| from_binary(include_bytes!("../../../sublime/syntaxes/newlines.packdump")));

pub static THEME_SET: Lazy<ThemeSet> =
Lazy::new(|| from_binary(include_bytes!("../../../sublime/themes/all.themedump")));

#[derive(Clone, Debug, PartialEq, Eq)]
pub enum HighlightSource {
Expand Down

0 comments on commit e2cdf00

Please sign in to comment.