Skip to content

Commit 3c7173c

Browse files
authored
Merge pull request #734 from godot-rust/qol/no-fmt-crate
Integrate `godot-fmt` crate into `godot-codegen`
2 parents 799c3f5 + d4e314a commit 3c7173c

File tree

8 files changed

+16
-34
lines changed

8 files changed

+16
-34
lines changed

Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ members = [
1313
"itest/rust",
1414
"examples/dodge-the-creeps/rust",
1515
"examples/hot-reload/rust",
16-
17-
# utils
18-
"godot-fmt",
1916
]
2017

2118
#[patch."https://github.com/godot-rust/godot4-prebuilt"]

godot-codegen/Cargo.toml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ experimental-godot-api = []
1818

1919
[dependencies]
2020
godot-bindings = { path = "../godot-bindings" }
21-
godot-fmt = { path = "../godot-fmt" }
2221

2322
heck = "0.4"
2423
nanoserde = "0.1.35"
@@ -38,3 +37,14 @@ godot-bindings = { path = "../godot-bindings" } # emit_godot_version_cfg
3837
[package.metadata.docs.rs]
3938
features = ["experimental-godot-api"]
4039
rustdoc-args = ["--cfg", "published_docs"]
40+
41+
42+
# To check formatter: Disabled below, since it pulls in too many dependencies during `cargo test` but is not really used.
43+
# Dev-dependencies cannot be optional and feature-gated. Enable manually when needed.
44+
45+
#[[bench]]
46+
#name = "gdext_fmt_bench"
47+
#harness = false
48+
#
49+
#[dev-dependencies]
50+
#criterion = "0.5"

godot-fmt/benches/gdext_bench.rs renamed to godot-codegen/src/formatter/benches/gdext_fmt_bench.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ pub fn criterion_benchmark(c: &mut Criterion) {
1919
let test_cases_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
2020
.parent()
2121
.unwrap()
22-
.join("godot-fmt")
22+
.join("godot-codegen")
23+
.join("src")
24+
.join("formatter")
2325
.join("test-cases");
2426

2527
for dir_entry in std::fs::read_dir(test_cases_dir).unwrap() {
File renamed without changes.

godot-codegen/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
mod context;
1212
mod conv;
13+
mod formatter;
1314
mod generator;
1415
mod models;
1516
mod special_cases;
@@ -47,7 +48,7 @@ fn write_file(path: &Path, contents: String) {
4748

4849
#[cfg(feature = "codegen-fmt")]
4950
fn submit_fn(path: PathBuf, tokens: TokenStream) {
50-
write_file(&path, godot_fmt::format_tokens(tokens));
51+
write_file(&path, formatter::format_tokens(tokens));
5152
}
5253

5354
#[cfg(not(feature = "codegen-fmt"))]

godot-fmt/Cargo.toml

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

0 commit comments

Comments
 (0)