Skip to content

Commit

Permalink
style(code): use "formatdoc!" over "format!(indoc!{"
Browse files Browse the repository at this point in the history
  • Loading branch information
hasezoey committed Oct 30, 2023
1 parent c1e9565 commit 91e6bf2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/code.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use heck::{ToPascalCase, ToSnakeCase};
use indoc::indoc;
use indoc::formatdoc;
use std::borrow::Cow;

use crate::parser::{ParsedColumnMacro, ParsedTableMacro, FILE_SIGNATURE};
Expand Down Expand Up @@ -316,14 +316,14 @@ impl<'a> Struct<'a> {
lines.push(format!(r#" pub {field_name}: {field_type},"#));
}

let struct_code = format!(
indoc! {r#"
let struct_code = formatdoc!(
r#"
{tsync_attr}{derive_attr}
#[diesel(table_name={table_name}{primary_key}{belongs_to})]
pub struct {struct_name}{lifetimes} {{
{lines}
}}
"#},
"#,
tsync_attr = self.attr_tsync(),
derive_attr = self.attr_derive(),
table_name = table.name,
Expand Down Expand Up @@ -611,14 +611,14 @@ fn build_imports(table: &ParsedTableMacro, config: &GenerationConfig) -> String
"".into()
};

format!(
indoc! {"
formatdoc!(
"
use crate::diesel::*;
use {schema_path};{fns_imports}{common_structs_imports}
{serde_imports}{async_imports}
{belongs_imports}
{connection_type_alias}
"},
",
belongs_imports = belongs_imports,
async_imports = async_imports,
schema_path = schema_path,
Expand Down

0 comments on commit 91e6bf2

Please sign in to comment.