Skip to content

Commit 79d59df

Browse files
fhunlethmichalmuskala
authored andcommitted
Remove unneeded workarounds for xref warnings
1 parent baac78e commit 79d59df

File tree

3 files changed

+3
-10
lines changed

3 files changed

+3
-10
lines changed

lib/decoder.ex

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,8 @@ defmodule Jason.Decoder do
8989
if Code.ensure_loaded?(Decimal) do
9090
defp float_decode_function(%{floats: :decimals}) do
9191
fn string, token, skip ->
92-
# silence xref warning
93-
decimal = Decimal
94-
9592
try do
96-
decimal.new(string)
93+
Decimal.new(string)
9794
rescue
9895
Decimal.Error ->
9996
token_error(token, skip)

lib/encode.ex

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,7 @@ defmodule Jason.Encode do
258258

259259
if Code.ensure_loaded?(Decimal) do
260260
defp struct(value, _escape, _encode_map, Decimal) do
261-
# silence the xref warning
262-
decimal = Decimal
263-
[?", decimal.to_string(value, :normal), ?"]
261+
[?", Decimal.to_string(value, :normal), ?"]
264262
end
265263
end
266264

lib/encoder.ex

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,7 @@ end
227227
if Code.ensure_loaded?(Decimal) do
228228
defimpl Jason.Encoder, for: Decimal do
229229
def encode(value, _opts) do
230-
# silence the xref warning
231-
decimal = Decimal
232-
[?", decimal.to_string(value), ?"]
230+
[?", Decimal.to_string(value), ?"]
233231
end
234232
end
235233
end

0 commit comments

Comments
 (0)