diff options
author | Brian Dawn | 2021-06-05 16:50:34 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-06-06 01:49:17 +0000 |
commit | ae105812d6c7ec20220d78d453f614438fbc5ba4 (patch) | |
tree | a548bf044037793ad63b2108f90f417f7c70acd7 | |
parent | 255598a2cb871ffc6cb3cc07a464acdd6e4d8293 (diff) |
Apply suggestions from code review
Co-authored-by: Ivan Tham <pickfire@riseup.net>
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | book/src/install.md | 2 | ||||
-rw-r--r-- | helix-core/src/syntax.rs | 7 |
3 files changed, 4 insertions, 8 deletions
@@ -45,7 +45,7 @@ the `HELIX_RUNTIME` environment variable. > NOTE: You should set this to <path to repository>/runtime in development (if > running via cargo). -If you want to bake the `runtime/` directory into the Helix binary you can build +If you want to embed the `runtime/` directory into the Helix binary you can build it with: ``` @@ -82,4 +82,3 @@ All shortcuts/keymaps can be found in the documentation on the website: # Getting help Discuss the project on the community [Matrix Space](https://matrix.to/#/#helix-community:matrix.org) (make sure to join `#helix-editor:matrix.org` if you're on a client that doesn't support Matrix Spaces yet). - diff --git a/book/src/install.md b/book/src/install.md index 8cbff1a5..0a08af8c 100644 --- a/book/src/install.md +++ b/book/src/install.md @@ -36,7 +36,7 @@ Now copy the `runtime/` directory somewhere. Helix will by default look for the runtime inside the same folder as the executable, but that can be overriden via the `HELIX_RUNTIME` environment variable. -If you want to bake the `runtime/` directory into the Helix binary you can build +If you want to embed the `runtime/` directory into the Helix binary you can build it with: ``` diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs index 2d1cbccb..a046a9c5 100644 --- a/helix-core/src/syntax.rs +++ b/helix-core/src/syntax.rs @@ -81,10 +81,7 @@ fn load_runtime_file(language: &str, filename: &str) -> Result<String, std::io:: } #[cfg(feature = "embed_runtime")] -use rust_embed::RustEmbed; - -#[cfg(feature = "embed_runtime")] -#[derive(RustEmbed)] +#[derive(rust_embed::RustEmbed)] #[folder = "../runtime/"] struct Runtime; @@ -93,7 +90,7 @@ fn load_runtime_file(language: &str, filename: &str) -> Result<String, Box<dyn s let root = PathBuf::new(); let path = root.join("queries").join(language).join(filename); - let query_bytes = Runtime::get(&path.as_path().display().to_string()).unwrap_or_default(); + let query_bytes = Runtime::get(&path.display().to_string()).unwrap_or_default(); std::str::from_utf8(query_bytes.as_ref()) .map(|s| s.to_string()) .map_err(|err| err.into()) |