Skip to content

Commit

Permalink
Adjust formatting rules to always re-format to new styles
Browse files Browse the repository at this point in the history
Apply changes to rest of codebase again
  • Loading branch information
Blacksmoke16 committed Oct 1, 2024
1 parent 711d9e8 commit a81ed39
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
11 changes: 1 addition & 10 deletions spec/compiler/formatter/formatter_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -747,15 +747,6 @@ describe Crystal::Formatter do
assert_format "macro f\n yield\n {{ yield }}\nend"
end

# Allows trailing commas, but doesn't enforce them
assert_format <<-CRYSTAL
def foo(
a,
b
)
end
CRYSTAL

assert_format <<-CRYSTAL
def foo(
a,
Expand Down Expand Up @@ -1580,7 +1571,7 @@ describe Crystal::Formatter do
assert_format "-> : Int32 { }"
assert_format "-> do\nend"

assert_format "-> : Int32 {}"
assert_format "-> : Int32 { }"
assert_format "-> : Int32 | String { 1 }"
assert_format "-> : Array(Int32) {}", "-> : Array(Int32) { }"
assert_format "-> : Int32? {}", "-> : Int32? { }"
Expand Down
4 changes: 2 additions & 2 deletions src/compiler/crystal/tools/formatter.cr
Original file line number Diff line number Diff line change
Expand Up @@ -4273,15 +4273,15 @@ module Crystal
skip_space_or_newline
end

write " " if a_def.args.present? || return_type || whitespace_after_op_minus_gt
write " "

is_do = false
if @token.keyword?(:do)
write_keyword :do
is_do = true
else
write_token :OP_LCURLY
write " " if a_def.body.is_a?(Nop) && @token.type.space?
write " " if a_def.body.is_a?(Nop)
end
skip_space

Expand Down
2 changes: 1 addition & 1 deletion src/kernel.cr
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ end
def self.after_fork_child_callbacks
@@after_fork_child_callbacks ||= [
# reinit event loop first:
->{ Crystal::EventLoop.current.after_fork },
-> { Crystal::EventLoop.current.after_fork },

# reinit signal handling:
->Crystal::System::Signal.after_fork,
Expand Down

0 comments on commit a81ed39

Please sign in to comment.