From 9517f562f1fe981e93954e7bd27bbe5962326360 Mon Sep 17 00:00:00 2001 From: Frank Hunleth Date: Sat, 13 Jul 2024 16:46:06 -0400 Subject: [PATCH] Remove unneeded workarounds for xref warnings --- lib/decoder.ex | 5 +---- lib/encode.ex | 4 +--- lib/encoder.ex | 4 +--- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/lib/decoder.ex b/lib/decoder.ex index ed34e71..478789f 100644 --- a/lib/decoder.ex +++ b/lib/decoder.ex @@ -89,11 +89,8 @@ defmodule Jason.Decoder do if Code.ensure_loaded?(Decimal) do defp float_decode_function(%{floats: :decimals}) do fn string, token, skip -> - # silence xref warning - decimal = Decimal - try do - decimal.new(string) + Decimal.new(string) rescue Decimal.Error -> token_error(token, skip) diff --git a/lib/encode.ex b/lib/encode.ex index fbff621..dfb314d 100644 --- a/lib/encode.ex +++ b/lib/encode.ex @@ -238,9 +238,7 @@ defmodule Jason.Encode do if Code.ensure_loaded?(Decimal) do defp struct(value, _escape, _encode_map, Decimal) do - # silence the xref warning - decimal = Decimal - [?", decimal.to_string(value, :normal), ?"] + [?", Decimal.to_string(value, :normal), ?"] end end diff --git a/lib/encoder.ex b/lib/encoder.ex index 519ee20..95fbf0c 100644 --- a/lib/encoder.ex +++ b/lib/encoder.ex @@ -227,9 +227,7 @@ end if Code.ensure_loaded?(Decimal) do defimpl Jason.Encoder, for: Decimal do def encode(value, _opts) do - # silence the xref warning - decimal = Decimal - [?", decimal.to_string(value), ?"] + [?", Decimal.to_string(value), ?"] end end end