aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/tools/src/lib.rs2
-rw-r--r--crates/tools/src/main.rs4
-rw-r--r--crates/tools/tests/cli.rs4
3 files changed, 5 insertions, 5 deletions
diff --git a/crates/tools/src/lib.rs b/crates/tools/src/lib.rs
index 548b157dd..9a1b12a16 100644
--- a/crates/tools/src/lib.rs
+++ b/crates/tools/src/lib.rs
@@ -77,7 +77,7 @@ pub fn update(path: &Path, contents: &str, verify: bool) -> Result<()> {
77 Ok(()) 77 Ok(())
78} 78}
79 79
80pub fn render_template(template: PathBuf) -> Result<String> { 80pub fn render_template(template: &Path) -> Result<String> {
81 let grammar: ron::value::Value = { 81 let grammar: ron::value::Value = {
82 let text = fs::read_to_string(project_root().join(GRAMMAR))?; 82 let text = fs::read_to_string(project_root().join(GRAMMAR))?;
83 ron::de::from_str(&text)? 83 ron::de::from_str(&text)?
diff --git a/crates/tools/src/main.rs b/crates/tools/src/main.rs
index 549892bc6..6eacfc190 100644
--- a/crates/tools/src/main.rs
+++ b/crates/tools/src/main.rs
@@ -40,8 +40,8 @@ fn main() -> Result<()> {
40fn run_gen_command(name: &str, verify: bool) -> Result<()> { 40fn run_gen_command(name: &str, verify: bool) -> Result<()> {
41 match name { 41 match name {
42 "gen-kinds" => { 42 "gen-kinds" => {
43 update(&project_root().join(SYNTAX_KINDS), &render_template(project_root().join(SYNTAX_KINDS_TEMPLATE))?, verify)?; 43 update(&project_root().join(SYNTAX_KINDS), &render_template(&project_root().join(SYNTAX_KINDS_TEMPLATE))?, verify)?;
44 update(&project_root().join(AST), &render_template(project_root().join(AST_TEMPLATE))?, verify)?; 44 update(&project_root().join(AST), &render_template(&project_root().join(AST_TEMPLATE))?, verify)?;
45 }, 45 },
46 "gen-tests" => { 46 "gen-tests" => {
47 gen_tests(verify)? 47 gen_tests(verify)?
diff --git a/crates/tools/tests/cli.rs b/crates/tools/tests/cli.rs
index d0ed60f7a..f507d80a2 100644
--- a/crates/tools/tests/cli.rs
+++ b/crates/tools/tests/cli.rs
@@ -4,10 +4,10 @@ use tools::{AST, AST_TEMPLATE, SYNTAX_KINDS, SYNTAX_KINDS_TEMPLATE, render_templ
4 4
5#[test] 5#[test]
6fn verify_template_generation() { 6fn verify_template_generation() {
7 if let Err(error) = update(&project_root().join(SYNTAX_KINDS), &render_template(project_root().join(SYNTAX_KINDS_TEMPLATE)).unwrap(), true) { 7 if let Err(error) = update(&project_root().join(SYNTAX_KINDS), &render_template(&project_root().join(SYNTAX_KINDS_TEMPLATE)).unwrap(), true) {
8 panic!("{}. Please update it by running `cargo gen-kinds`", error); 8 panic!("{}. Please update it by running `cargo gen-kinds`", error);
9 } 9 }
10 if let Err(error) = update(&project_root().join(AST), &render_template(project_root().join(AST_TEMPLATE)).unwrap(), true) { 10 if let Err(error) = update(&project_root().join(AST), &render_template(&project_root().join(AST_TEMPLATE)).unwrap(), true) {
11 panic!("{}. Please update it by running `cargo gen-kinds`", error); 11 panic!("{}. Please update it by running `cargo gen-kinds`", error);
12 } 12 }
13} 13}