diff options
author | Cyborus <cyborus@cyborus.xyz> | 2024-02-10 04:49:32 +0100 |
---|---|---|
committer | Cyborus <cyborus@cyborus.xyz> | 2024-02-10 04:49:32 +0100 |
commit | ed27e3d71400761c442903bcf8c0f85898c6ea97 (patch) | |
tree | 3795991f1fae458c0367e2bcd39ea70a7de8c901 /generator | |
parent | format (diff) | |
download | forgejo-api-ed27e3d71400761c442903bcf8c0f85898c6ea97.tar.xz forgejo-api-ed27e3d71400761c442903bcf8c0f85898c6ea97.zip |
remove trailing doc comment lines
Diffstat (limited to 'generator')
-rw-r--r-- | generator/src/methods.rs | 3 | ||||
-rw-r--r-- | generator/src/structs.rs | 9 |
2 files changed, 12 insertions, 0 deletions
diff --git a/generator/src/methods.rs b/generator/src/methods.rs index 23df8c9..025f159 100644 --- a/generator/src/methods.rs +++ b/generator/src/methods.rs @@ -124,6 +124,9 @@ fn method_docs(spec: &OpenApiV2, op: &Operation) -> eyre::Result<String> { } } } + if out.ends_with("/// \n") { + out.truncate(out.len() - 5); + } Ok(out) } diff --git a/generator/src/structs.rs b/generator/src/structs.rs index 842e557..84655e9 100644 --- a/generator/src/structs.rs +++ b/generator/src/structs.rs @@ -90,6 +90,9 @@ pub fn create_struct_for_definition( fields.push_str(line); fields.push_str("\n/// \n"); } + if fields.ends_with("/// \n") { + fields.truncate(fields.len() - 5); + } } } if &field_name != prop_name { @@ -173,6 +176,9 @@ fn create_struct_docs_str(description: Option<&str>) -> eyre::Result<String> { out.push_str(line); out.push_str("\n/// \n"); } + if out.ends_with("/// \n") { + out.truncate(out.len() - 5); + } out } None => String::new(), @@ -265,6 +271,9 @@ fn create_query_struct(spec: &OpenApiV2, op: &Operation) -> eyre::Result<String> fields.push_str(line); fields.push_str("\n/// \n"); } + if fields.ends_with("/// \n") { + fields.truncate(fields.len() - 5); + } } fields.push_str("pub "); fields.push_str(&field_name); |