diff options
author | Blaž Hrastnik | 2021-07-30 07:27:22 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-07-30 07:27:22 +0000 |
commit | 0fdb626c2cc5518b10a9bfbedc8b78cff3d360c9 (patch) | |
tree | 71f4e454929bac7b2882a855a2df3078993bf4cc /helix-core | |
parent | f88d4c1e20d4dbc244599ad3f3a5f301bec239bf (diff) |
Remove embed_runtime feature
It's no longer practical to maintain. Closes #451
Diffstat (limited to 'helix-core')
-rw-r--r-- | helix-core/Cargo.toml | 2 | ||||
-rw-r--r-- | helix-core/src/lib.rs | 1 | ||||
-rw-r--r-- | helix-core/src/syntax.rs | 29 |
3 files changed, 0 insertions, 32 deletions
diff --git a/helix-core/Cargo.toml b/helix-core/Cargo.toml index 634c4d9f..4316dc2c 100644 --- a/helix-core/Cargo.toml +++ b/helix-core/Cargo.toml @@ -11,7 +11,6 @@ homepage = "https://helix-editor.com" include = ["src/**/*", "README.md"] [features] -embed_runtime = ["rust-embed"] [dependencies] helix-syntax = { version = "0.3", path = "../helix-syntax" } @@ -34,7 +33,6 @@ toml = "0.5" similar = "1.3" etcetera = "0.3" -rust-embed = { version = "5.9.0", optional = true } [dev-dependencies] quickcheck = { version = "1", default-features = false } diff --git a/helix-core/src/lib.rs b/helix-core/src/lib.rs index 3684a93e..2823959f 100644 --- a/helix-core/src/lib.rs +++ b/helix-core/src/lib.rs @@ -58,7 +58,6 @@ pub fn find_root(root: Option<&str>) -> Option<std::path::PathBuf> { None } -#[cfg(not(embed_runtime))] pub fn runtime_dir() -> std::path::PathBuf { if let Ok(dir) = std::env::var("HELIX_RUNTIME") { return dir.into(); diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs index c8cb0557..60d44976 100644 --- a/helix-core/src/syntax.rs +++ b/helix-core/src/syntax.rs @@ -84,7 +84,6 @@ pub struct IndentQuery { pub outdent: HashSet<String>, } -#[cfg(not(feature = "embed_runtime"))] fn load_runtime_file(language: &str, filename: &str) -> Result<String, std::io::Error> { let path = crate::RUNTIME_DIR .join("queries") @@ -93,34 +92,6 @@ fn load_runtime_file(language: &str, filename: &str) -> Result<String, std::io:: std::fs::read_to_string(&path) } -#[cfg(feature = "embed_runtime")] -fn load_runtime_file(language: &str, filename: &str) -> Result<String, Box<dyn std::error::Error>> { - use std::path::PathBuf; - - #[derive(rust_embed::RustEmbed)] - #[folder = "../runtime/"] - struct Runtime; - - #[derive(Debug)] - struct EmbeddedFileNotFoundError { - path: PathBuf, - } - impl std::error::Error for EmbeddedFileNotFoundError {} - impl fmt::Display for EmbeddedFileNotFoundError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "failed to load embedded file {}", self.path.display()) - } - } - - let path = PathBuf::from("queries").join(language).join(filename); - - if let Some(query_bytes) = Runtime::get(&path.display().to_string()) { - String::from_utf8(query_bytes.to_vec()).map_err(|err| err.into()) - } else { - Err(Box::new(EmbeddedFileNotFoundError { path })) - } -} - fn read_query(language: &str, filename: &str) -> String { static INHERITS_REGEX: Lazy<Regex> = Lazy::new(|| Regex::new(r";+\s*inherits\s*:?\s*([a-z_,()]+)\s*").unwrap()); |