Skip to content

Commit d31be43

Browse files
style: fix rustfmt formatting in templates.rs
Amp-Thread-ID: https://ampcode.com/threads/T-019c51dc-7336-754e-80f5-ac600f50590f Co-authored-by: Amp <amp@ampcode.com>
1 parent 4acffe8 commit d31be43

1 file changed

Lines changed: 52 additions & 49 deletions

File tree

xdk-lib/src/templates.rs

Lines changed: 52 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -88,55 +88,58 @@ fn get_header_for_file(template_name: &str, output_path: Option<&str>) -> String
8888
};
8989

9090
// Determine file type from template name if not determined from path
91-
let (comment_start, comment_line, comment_end) =
92-
if file_type == "python" || file_type == "toml" || file_type == "ignore" || file_type == "elixir" {
93-
("", "#", "")
94-
} else if file_type == "typescript" {
95-
("", "//", "")
96-
} else if file_type == "json" {
97-
return String::new();
98-
} else if file_type == "markdown" {
99-
("<!--", "", "-->")
100-
} else if template_name.ends_with("_py")
101-
|| template_name.contains("python")
102-
|| template_name == "pyproject_toml"
103-
|| template_name.contains("_toml")
104-
|| template_name == "main_client"
105-
|| template_name.starts_with("test_")
106-
|| template_name == "conftest"
107-
{
108-
// Python and TOML files use # comments
109-
("", "#", "")
110-
} else if template_name.ends_with("_ts")
111-
|| template_name.contains("typescript")
112-
|| template_name.contains(".ts")
113-
|| template_name == "tsconfig"
114-
|| template_name == "tsup.config"
115-
|| template_name.contains("http_client")
116-
|| template_name.contains("crypto")
117-
|| template_name.contains("oauth1_auth")
118-
|| template_name == "index"
119-
|| template_name == "schemas"
120-
|| template_name.contains("generate_docs")
121-
{
122-
// TypeScript/JavaScript files use // comments
123-
("", "//", "")
124-
} else if template_name == "package_json"
125-
|| template_name == "typedoc.json"
126-
|| template_name.contains(".json")
127-
{
128-
// JSON files - no comments, return empty
129-
return String::new();
130-
} else if template_name == "readme" || template_name.ends_with("_md") {
131-
// Markdown files use HTML comments
132-
("<!--", "", "-->")
133-
} else if template_name == "npmignore" || template_name.ends_with("ignore") {
134-
// Ignore files use # comments
135-
("", "#", "")
136-
} else {
137-
// Default: use // for unknown types
138-
("", "//", "")
139-
};
91+
let (comment_start, comment_line, comment_end) = if file_type == "python"
92+
|| file_type == "toml"
93+
|| file_type == "ignore"
94+
|| file_type == "elixir"
95+
{
96+
("", "#", "")
97+
} else if file_type == "typescript" {
98+
("", "//", "")
99+
} else if file_type == "json" {
100+
return String::new();
101+
} else if file_type == "markdown" {
102+
("<!--", "", "-->")
103+
} else if template_name.ends_with("_py")
104+
|| template_name.contains("python")
105+
|| template_name == "pyproject_toml"
106+
|| template_name.contains("_toml")
107+
|| template_name == "main_client"
108+
|| template_name.starts_with("test_")
109+
|| template_name == "conftest"
110+
{
111+
// Python and TOML files use # comments
112+
("", "#", "")
113+
} else if template_name.ends_with("_ts")
114+
|| template_name.contains("typescript")
115+
|| template_name.contains(".ts")
116+
|| template_name == "tsconfig"
117+
|| template_name == "tsup.config"
118+
|| template_name.contains("http_client")
119+
|| template_name.contains("crypto")
120+
|| template_name.contains("oauth1_auth")
121+
|| template_name == "index"
122+
|| template_name == "schemas"
123+
|| template_name.contains("generate_docs")
124+
{
125+
// TypeScript/JavaScript files use // comments
126+
("", "//", "")
127+
} else if template_name == "package_json"
128+
|| template_name == "typedoc.json"
129+
|| template_name.contains(".json")
130+
{
131+
// JSON files - no comments, return empty
132+
return String::new();
133+
} else if template_name == "readme" || template_name.ends_with("_md") {
134+
// Markdown files use HTML comments
135+
("<!--", "", "-->")
136+
} else if template_name == "npmignore" || template_name.ends_with("ignore") {
137+
// Ignore files use # comments
138+
("", "#", "")
139+
} else {
140+
// Default: use // for unknown types
141+
("", "//", "")
142+
};
140143

141144
let notice = "AUTO-GENERATED FILE - DO NOT EDIT";
142145
let details = "This file was automatically generated by the XDK build tool.";

0 commit comments

Comments
 (0)