File tree 3 files changed +7
-6
lines changed
3 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -326,6 +326,7 @@ describe Crystal::Formatter do
326
326
assert_format " 1 && 2" , " 1 && 2"
327
327
assert_format " 1 &&\n 2" , " 1 &&\n 2"
328
328
assert_format " 1 &&\n 2 &&\n 3" , " 1 &&\n 2 &&\n 3"
329
+ assert_format " 1 && # foo\n 2 &&\n 3"
329
330
assert_format " if 0\n 1 &&\n 2 &&\n 3\n end" , " if 0\n 1 &&\n 2 &&\n 3\n end"
330
331
assert_format " if 1 &&\n 2 &&\n 3\n 4\n end" , " if 1 &&\n 2 &&\n 3\n 4\n end"
331
332
assert_format " if 1 &&\n (2 || 3)\n 1\n else\n 2\n end"
Original file line number Diff line number Diff line change @@ -2946,8 +2946,8 @@ module Crystal
2946
2946
end
2947
2947
2948
2948
write_token " " , token
2949
- skip_space
2950
- if @token .type == :NEWLINE
2949
+ found_comment = skip_space
2950
+ if found_comment || @token .type == :NEWLINE
2951
2951
if @inside_call_or_assign == 0
2952
2952
next_indent = @inside_cond == 0 ? @indent + 2 : @indent
2953
2953
else
Original file line number Diff line number Diff line change @@ -126,10 +126,10 @@ module Float::Printer::Grisu3
126
126
# We need to do the following tests in this order to avoid over- and
127
127
# underflows.
128
128
while (
129
- rest < small_distance && # Negated condition 1
130
- unsafe_interval - rest >= ten_kappa && # Negated condition 2
131
- (rest + ten_kappa < small_distance || # buffer{-1} > w_high
132
- small_distance - rest >= rest + ten_kappa - small_distance)
129
+ rest < small_distance && # Negated condition 1
130
+ unsafe_interval - rest >= ten_kappa && # Negated condition 2
131
+ (rest + ten_kappa < small_distance || # buffer{-1} > w_high
132
+ small_distance - rest >= rest + ten_kappa - small_distance)
133
133
)
134
134
buffer[length - 1 ] -= 1
135
135
rest += ten_kappa
You can’t perform that action at this time.
0 commit comments