-
Couldn't load subscription status.
- Fork 962
Closed
Labels
I-poor-formattingIssue: poor formattingIssue: poor formatting
Description
I have noticed that rustfmt leaves those 2 equivalent functions unchanged, although they are differently formatted:
fn first_function() -> ReturnType {
struct inner_item {
field: u32,
}; // <- With a semicolon.
last_expression
}
fn second_function() -> ReturnType {
struct inner_item {
field: u32,
} // <- Without a semicolon.
last_expression
}Is this something that rustfmt should have an opinion about?
I would like the answer to be yes, because I would not have to choose myself whether to write this semicolon or not.
But I would understand that the answer be no, because ; is an additional (empty) statement that does not appear in the second_function, so the two functions are somewhat different. However, if this is how rustfmt stands, then it should maybe reformat the first snippet to
fn first_function() -> ReturnType {
struct inner_item {
field: u32,
}
; // <- Make it clear that this is additional, empty statement.
last_expression
}Metadata
Metadata
Assignees
Labels
I-poor-formattingIssue: poor formattingIssue: poor formatting