Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions sway-fmt-v2/src/items/item_struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,22 @@ impl Format for ItemStruct {

/// Format the struct if the multiline is passed as false struct will be formatted into a single line.
///
/// Example (multiline : false):
/// ## Examples
///
/// (multiline : false):
///
/// ```rust,ignore
/// struct Foo { bar: u64, baz: bool }
/// ```
///
/// (multiline : true):
///
/// Example (multiline : true):
/// ```rust,ignore
/// struct Foo {
/// bar: u64,
/// baz: bool,
/// bar: u64,
/// baz: bool,
/// }
/// ```
fn format_struct(
item_struct: &ItemStruct,
formatted_code: &mut FormattedCode,
Expand Down
7 changes: 3 additions & 4 deletions sway-fmt-v2/src/utils/program_type.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use sway_parse::ModuleKind;
use sway_parse::{token::PunctKind, ModuleKind};
use sway_types::Spanned;

/// Insert the program type without applying a formatting to it.
Expand All @@ -24,7 +24,6 @@ pub(crate) fn insert_program_type(push_to: &mut String, module_kind: ModuleKind)
push_to.push_str(name.as_str());
}
};
push_to.push(';');
push_to.push('\n');
push_to.push('\n');
push_to.push(PunctKind::Semicolon.as_char());
push_to.push_str("\n\n");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also here ^

}