Skip to content

Commit 92a44c9

Browse files
committed
cleanup
1 parent dfce4d3 commit 92a44c9

File tree

5 files changed

+9
-22
lines changed

5 files changed

+9
-22
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
crates/squawk_parser/src/generated/* linguist-generated=true
2+
crates/squawk_syntax/src/ast/generated/* linguist-generated=true

crates/xtask/src/keywords.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::path_util::cwd_to_workspace_root;
1+
use crate::path::project_root;
22
use anyhow::{Context, Ok, Result};
33
use enum_iterator::{all, Sequence};
44
use std::collections::{HashMap, HashSet};
@@ -75,9 +75,8 @@ fn keyword_allowed(cat: KeywordCategory, kw_type: KWType) -> bool {
7575
}
7676

7777
fn parse_header() -> Result<HashMap<String, KeywordMeta>> {
78-
cwd_to_workspace_root().context("Failed to cwd to root")?;
79-
80-
let data = std::fs::read_to_string("postgres/kwlist.h").context("Failed to read kwlist.h")?;
78+
let kwlist_file = project_root().join("postgres/kwlist.h");
79+
let data = std::fs::read_to_string(kwlist_file).context("Failed to read kwlist.h")?;
8180

8281
let mut keywords = HashMap::new();
8382

crates/xtask/src/main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ mod download_regression_tests;
1010
mod keywords;
1111
mod new_rule;
1212
mod path;
13-
mod path_util;
1413
mod sync_kwlist;
1514

1615
#[derive(Subcommand, Debug)]

crates/xtask/src/path_util.rs

Lines changed: 0 additions & 12 deletions
This file was deleted.

crates/xtask/src/sync_kwlist.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use anyhow::{Context, Result};
1+
use anyhow::Result;
22
use reqwest::header::USER_AGENT;
33
use serde::Deserialize;
44

@@ -10,7 +10,7 @@ pub(crate) fn sync_kwlist() -> Result<()> {
1010
use std::fs;
1111
use std::io::Write;
1212

13-
use crate::path_util::cwd_to_workspace_root;
13+
use crate::path::project_root;
1414

1515
#[derive(Deserialize, Debug)]
1616
struct CommitResponse {
@@ -46,8 +46,6 @@ fn latest_pg_git_sha() -> Result<()> {
4646

4747
let file_content = file_response.text()?;
4848

49-
cwd_to_workspace_root().context("Failed to cwd to root")?;
50-
5149
let preamble = format!(
5250
r"// synced from:
5351
// commit: {}
@@ -62,7 +60,8 @@ fn latest_pg_git_sha() -> Result<()> {
6260
)
6361
.to_owned();
6462

65-
let mut file = fs::File::create("postgres/kwlist.h")?;
63+
let kwlist_file = project_root().join("postgres/kwlist.h");
64+
let mut file = fs::File::create(kwlist_file)?;
6665
file.write_all((preamble + &file_content).as_bytes())?;
6766

6867
Ok(())

0 commit comments

Comments
 (0)