Skip to content

Commit 6ee8ea2

Browse files
authored
Replace Symbol impl with stringleton (#79)
1 parent 6207619 commit 6ee8ea2

27 files changed

Lines changed: 109 additions & 302 deletions

Cargo.lock

Lines changed: 51 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ toml_edit = "0.23.9"
3434
futures = "0.3.31"
3535
annotate-snippets = "0.12.10"
3636
anstream = "0.6.18"
37+
stringleton = { version = "0.2.1", features = ["serde"] }
3738

3839
[workspace.lints.clippy]
3940
pedantic = { level = "warn", priority = -1 }

tests/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ werk-util.workspace = true
2525
anstream.workspace = true
2626
# Hijacking winnow for the Offset trait
2727
winnow.workspace = true
28+
stringleton.workspace = true
2829

2930
[dev-dependencies]
3031
criterion = "0.8.1"

tests/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
// This file intentionally left blank.
22
pub mod mock_io;
3+
4+
stringleton::enable!(werk_runner);

tests/test_expressions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use werk_runner::Value;
22

3+
use stringleton::Symbol;
34
use tests::mock_io::*;
4-
use werk_util::Symbol;
55

66
fn evaluate_global(source: &str, global_variable_name_to_check: &str) -> Value {
77
let mut test = Test::new(source).unwrap();

tests/test_outdatedness.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ use macro_rules_attribute::apply;
22
use tests::mock_io;
33

44
use mock_io::*;
5+
use stringleton::Symbol;
56
use werk_fs::{Absolute, Path};
67
use werk_runner::{BuildStatus, Outdatedness, Reason, ShellCommandLine, TaskId};
7-
use werk_util::Symbol;
88

99
static WERK: &str = r#"
1010
config profile = env "PROFILE"

tests/test_path_resolution.rs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
use macro_rules_attribute::apply;
2+
use stringleton::sym;
23
use tests::mock_io::*;
34
use werk_fs::Absolute;
45
use werk_runner::{Runner, TaskId, Value};
5-
use werk_util::{Annotated, Symbol};
6+
use werk_util::Annotated;
7+
8+
stringleton::enable!(tests);
69

710
#[test]
811
fn test_path_resolution() {
@@ -44,41 +47,35 @@ let exists-not-explicit-workspace = "<exists-not:workspace>"
4447
};
4548
let globals = &workspace.manifest.global_variables;
4649
assert_eq!(
47-
globals.get(&Symbol::new("exists-resolved")).unwrap().value,
50+
globals.get(&sym!("exists-resolved")).unwrap().value,
4851
Value::from(foo_workspace.clone())
4952
);
5053
assert_eq!(
51-
globals
52-
.get(&Symbol::new("exists-explicit-out-dir"))
53-
.unwrap()
54-
.value,
54+
globals.get(&sym!("exists-explicit-out-dir")).unwrap().value,
5555
Value::from(foo_output)
5656
);
5757
assert_eq!(
5858
globals
59-
.get(&Symbol::new("exists-explicit-workspace"))
59+
.get(&sym!("exists-explicit-workspace"))
6060
.unwrap()
6161
.value,
6262
Value::from(foo_workspace.clone())
6363
);
6464

6565
assert_eq!(
66-
globals
67-
.get(&Symbol::new("exists-not-resolved"))
68-
.unwrap()
69-
.value,
66+
globals.get(&sym!("exists-not-resolved")).unwrap().value,
7067
Value::from(bar_output.clone())
7168
);
7269
assert_eq!(
7370
globals
74-
.get(&Symbol::new("exists-not-explicit-out-dir"))
71+
.get(&sym!("exists-not-explicit-out-dir"))
7572
.unwrap()
7673
.value,
7774
Value::from(bar_output.clone())
7875
);
7976
assert_eq!(
8077
globals
81-
.get(&Symbol::new("exists-not-explicit-workspace"))
78+
.get(&sym!("exists-not-explicit-workspace"))
8279
.unwrap()
8380
.value,
8481
Value::from(bar_workspace)

werk-fs/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ winnow.workspace = true
1313
thiserror.workspace = true
1414
serde.workspace = true
1515
werk-util.workspace = true
16+
stringleton.workspace = true
1617

1718
[lints]
1819
workspace = true

werk-fs/sym.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use werk_util::Symbol;
1+
use stringleton::Symbol;
22

33
use crate::{Absolute, Path, PathBuf};
44

werk-parser/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ regex.workspace = true
2020
annotate-snippets.workspace = true
2121
serde.workspace = true
2222
werk-util.workspace = true
23+
stringleton.workspace = true
2324

2425
[dev-dependencies]
2526
anstream.workspace = true

0 commit comments

Comments
 (0)