Skip to content

Commit 08bea85

Browse files
committed
Format
1 parent c9016b5 commit 08bea85

File tree

2 files changed

+34
-34
lines changed

2 files changed

+34
-34
lines changed

src/rust/model_gen.rs

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -338,23 +338,23 @@ pub fn multipart_field_module() -> Result<Module> {
338338
let code = unit()
339339
+ line(unit() + "pub trait MultipartField {")
340340
+ indented(
341-
unit()
342-
+ line("fn to_multipart_field(&self) -> String;")
343-
+ line("fn mime_type(&self) -> &'static str;"),
344-
)
341+
unit()
342+
+ line("fn to_multipart_field(&self) -> String;")
343+
+ line("fn mime_type(&self) -> &'static str;"),
344+
)
345345
+ line(unit() + "}")
346346
+ NewLine
347347
+ line(unit() + "impl<T: std::fmt::Display> MultipartField for T {")
348348
+ indented(
349-
unit()
350-
+ line("fn to_multipart_field(&self) -> String {")
351-
+ indented(line("self.to_string()"))
352-
+ line("}")
353-
+ NewLine
354-
+ line(unit() + "fn mime_type(&self) -> &'static str {")
355-
+ indented(line(r#""text/plain; charset=utf-8""#))
356-
+ line(unit() + "}"),
357-
)
349+
unit()
350+
+ line("fn to_multipart_field(&self) -> String {")
351+
+ indented(line("self.to_string()"))
352+
+ line("}")
353+
+ NewLine
354+
+ line(unit() + "fn mime_type(&self) -> &'static str {")
355+
+ indented(line(r#""text/plain; charset=utf-8""#))
356+
+ line(unit() + "}"),
357+
)
358358
+ line("}");
359359

360360
Ok(Module {
@@ -521,30 +521,30 @@ pub fn model_gen(
521521
+ derive_line()
522522
+ line(unit() + "pub struct " + &name + " {")
523523
+ indented(
524-
fields
525-
.into_iter()
526-
.reduce(|acc, e| acc + e)
527-
.unwrap_or_else(unit),
528-
)
524+
fields
525+
.into_iter()
526+
.reduce(|acc, e| acc + e)
527+
.unwrap_or_else(unit),
528+
)
529529
+ line(unit() + "}")
530530
+ NewLine
531531
+ line(
532-
unit()
533-
+ "impl "
534-
+ rust_name("crate::model", "MultipartField")
535-
+ " for "
536-
+ &name
537-
+ "{",
538-
)
532+
unit()
533+
+ "impl "
534+
+ rust_name("crate::model", "MultipartField")
535+
+ " for "
536+
+ &name
537+
+ "{",
538+
)
539539
+ indented(
540-
line(unit() + "fn to_multipart_field(&self) -> String {")
541-
+ indented(line("serde_json::to_string(self).unwrap()"))
542-
+ line("}")
543-
+ NewLine
544-
+ line(unit() + "fn mime_type(&self) -> &'static str {")
545-
+ indented(line(r#""application/json""#))
546-
+ line("}"),
547-
)
540+
line(unit() + "fn to_multipart_field(&self) -> String {")
541+
+ indented(line("serde_json::to_string(self).unwrap()"))
542+
+ line("}")
543+
+ NewLine
544+
+ line(unit() + "fn mime_type(&self) -> &'static str {")
545+
+ indented(line(r#""application/json""#))
546+
+ line("}"),
547+
)
548548
+ line("}");
549549

550550
Ok(code)

src/rust/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// limitations under the License.
1414

1515
use crate::printer::TreePrinter;
16+
use crate::rust::lib_gen::ModuleName;
1617
use crate::rust::model_gen::RefCache;
1718
use crate::rust::printer::{rust_name, unit, RustContext};
1819
use crate::{Error, Result};
@@ -22,7 +23,6 @@ use openapiv3::{
2223
VariantOrUnknownOrEmpty,
2324
};
2425
use std::fmt::Display;
25-
use crate::rust::lib_gen::ModuleName;
2626

2727
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2828
pub struct ModelType {

0 commit comments

Comments
 (0)