Skip to content

Commit

Permalink
fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
c12i committed May 20, 2024
1 parent c50b757 commit bcdfa34
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,11 @@ fn add_newlines(input: &str) -> String {
// Add a newline after the imports block
if !after_imports && line.trim().is_empty() {
after_imports = true;
formatted_code.push_str("\n");
formatted_code.push('\n');
}
// Add newlines between #[hdk_extern] annotated functions
if line.trim().starts_with("#[hdk_extern") && i > 0 {
formatted_code.push_str("\n");
formatted_code.push('\n');
}

// Add newlines between non #[hdk_extern] annoteted functions
Expand All @@ -195,12 +195,12 @@ fn add_newlines(input: &str) -> String {
if (functon_regex.is_match(line.trim()) && i > 0)
&& (!lines[i - 1].starts_with("#[hdk_extern"))
{
formatted_code.push_str("\n");
formatted_code.push('\n');
}

// Add newlines between #[derive] annotated structs/enums
if line.trim().starts_with("#[derive") && i > 0 {
formatted_code.push_str("\n");
formatted_code.push('\n');
}
formatted_code.push_str(line);
formatted_code.push('\n');
Expand Down

0 comments on commit bcdfa34

Please sign in to comment.