Skip to content

Commit 5e19ba6

Browse files
committed
[src/code.rs] Use multiline raw string syntax
1 parent 0038da7 commit 5e19ba6

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/code.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ pub struct StructField {
8585

8686
impl StructField {
8787
/// Assemble the current options into a rust type, like `base_type: String, is_optional: true` to `Option<String>`
88-
pub fn to_rust_type(&self) -> std::borrow::Cow<str> {
88+
pub fn to_rust_type(&self) -> std::borrow::Cow<'_, str> {
8989
let mut rust_type = self.base_type.clone();
9090

9191
// order matters!
@@ -804,8 +804,13 @@ fn build_default_impl_fn<'a>(
804804
.collect::<Vec<String>>()
805805
.join(",\n");
806806
format!(
807-
"impl Default for {struct_name} {{\n fn default() -> Self {{\n Self {{\n{f2d}\n }}\n }}\n}}",
808-
struct_name = struct_name, f2d=fields_to_defaults.as_str()
807+
r#"impl Default for {struct_name} {{
808+
fn default() -> Self {{
809+
Self {{
810+
{fields_to_defaults}
811+
}}
812+
}}
813+
}}"#
809814
)
810815
}
811816

0 commit comments

Comments
 (0)