diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-03-02 22:10:44 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-03-02 22:10:44 +0800 |
| commit | 8d6b68804768e873e6627b61fd34a551bf4090e6 (patch) | |
| tree | 4ae0ec9af2b9bbd7fe286d2a24b64066de43595f | |
| parent | 8f1cf091f62a36e30b8cf3e97b0de7eaec58e1bf (diff) | |
Fix empty impl block generating unnecessary newlines
| -rw-r--r-- | Cargo.lock | 2 | ||||
| -rw-r--r-- | Cargo.toml | 2 | ||||
| -rw-r--r-- | src/expand.rs | 6 |
3 files changed, 6 insertions, 4 deletions
@@ -10,7 +10,7 @@ checksum = "5454cda0d57db59778608d7a47bff5b16c6705598265869fb052b657f66cf05e" [[package]] name = "just_template" -version = "0.1.2" +version = "0.1.3" dependencies = [ "just_fmt", ] @@ -2,7 +2,7 @@ name = "just_template" authors = ["Weicao-CatilGrass"] description = "a tool for code gen via templates" -version = "0.1.2" +version = "0.1.3" edition = "2024" readme = "README.md" diff --git a/src/expand.rs b/src/expand.rs index 049b04d..5933b2c 100644 --- a/src/expand.rs +++ b/src/expand.rs @@ -135,8 +135,10 @@ fn apply_impls( continue; }; - applied_content += "\n"; - applied_content += impled_code.join("\n").as_str(); + if impled_code.len() > 0 { + applied_content += "\n"; + applied_content += impled_code.join("\n").as_str(); + } } else { // Other content directly appended applied_content += "\n"; |
