Skip to content

Commit 763e3a2

Browse files
authored
Fix 1.19 compiler warnings (#193)
* Fix 1.19 compiler warnings * Update credo to fix compile failure
1 parent 3e2055c commit 763e3a2

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

lib/ethereumex/client/websocket_server.ex

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -235,27 +235,27 @@ defmodule Ethereumex.WebsocketServer do
235235
@impl WebSockex
236236
def handle_connect(_conn, %State{} = state) do
237237
Logger.info("Connected to WebSocket server at #{state.url}")
238-
{:ok, %State{state | reconnect_attempts: 0}}
238+
{:ok, %{state | reconnect_attempts: 0}}
239239
end
240240

241241
@impl WebSockex
242242
def handle_cast({:request, id, request, from}, %State{} = state) do
243243
requests = Map.put(state.requests, id, from)
244-
new_state = %State{state | requests: requests}
244+
new_state = %{state | requests: requests}
245245
{:reply, {:text, request}, new_state}
246246
end
247247

248248
def handle_cast({:subscription, request, from}, %State{} = state) do
249249
subscription_requests = Map.put(state.subscription_requests, request.id, from)
250-
new_state = %State{state | subscription_requests: subscription_requests}
250+
new_state = %{state | subscription_requests: subscription_requests}
251251
{:reply, {:text, Config.json_module().encode!(request)}, new_state}
252252
end
253253

254254
def handle_cast({:unsubscribe, request, from}, %State{} = state) do
255255
unsubscription_requests =
256256
Map.put(state.unsubscription_requests, request.id, {from, request.params})
257257

258-
new_state = %State{state | unsubscription_requests: unsubscription_requests}
258+
new_state = %{state | unsubscription_requests: unsubscription_requests}
259259
{:reply, {:text, Config.json_module().encode!(request)}, new_state}
260260
end
261261

@@ -344,27 +344,27 @@ defmodule Ethereumex.WebsocketServer do
344344
{:ok, state}
345345
end
346346

347-
defp handle_request_response(state, id, result) do
347+
defp handle_request_response(%State{} = state, id, result) do
348348
send(Map.get(state.requests, id), {:response, id, result})
349-
%State{state | requests: Map.delete(state.requests, id)}
349+
%{state | requests: Map.delete(state.requests, id)}
350350
end
351351

352-
defp handle_subscription_response(state, id, result) do
352+
defp handle_subscription_response(%State{} = state, id, result) do
353353
pid = Map.get(state.subscription_requests, id)
354354
send(pid, {:response, id, result})
355355

356356
subscription_requests = Map.delete(state.subscription_requests, id)
357357
subscriptions = Map.put(state.subscriptions, result, pid)
358-
%State{state | subscription_requests: subscription_requests, subscriptions: subscriptions}
358+
%{state | subscription_requests: subscription_requests, subscriptions: subscriptions}
359359
end
360360

361-
defp handle_unsubscription_response(state, id, result) do
361+
defp handle_unsubscription_response(%State{} = state, id, result) do
362362
{pid, subscription_ids} = Map.get(state.unsubscription_requests, id)
363363
send(pid, {:response, id, result})
364364

365365
subscription_requests = Map.delete(state.subscription_requests, id)
366366
subscriptions = Map.drop(state.subscriptions, subscription_ids)
367-
%State{state | subscription_requests: subscription_requests, subscriptions: subscriptions}
367+
%{state | subscription_requests: subscription_requests, subscriptions: subscriptions}
368368
end
369369

370370
@spec get_request_id(list(map()) | map()) :: request_id()
@@ -385,10 +385,10 @@ defmodule Ethereumex.WebsocketServer do
385385

386386
defp should_retry?(attempts), do: attempts <= @max_reconnect_attempts
387387

388-
defp handle_retry(connection_status, state, attempts) do
388+
defp handle_retry(connection_status, %State{} = state, attempts) do
389389
log_retry_attempt(connection_status.reason, attempts)
390390
apply_backoff_delay(attempts)
391-
{:reconnect, %State{state | reconnect_attempts: attempts}}
391+
{:reconnect, %{state | reconnect_attempts: attempts}}
392392
end
393393

394394
defp handle_max_attempts_reached(connection_status, state) do

mix.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
%{
22
"bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"},
3-
"credo": {:hex, :credo, "1.7.11", "d3e805f7ddf6c9c854fd36f089649d7cf6ba74c42bc3795d587814e3c9847102", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "56826b4306843253a66e47ae45e98e7d284ee1f95d53d1612bb483f88a8cf219"},
3+
"credo": {:hex, :credo, "1.7.12", "9e3c20463de4b5f3f23721527fcaf16722ec815e70ff6c60b86412c695d426c1", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "8493d45c656c5427d9c729235b99d498bd133421f3e0a683e5c1b561471291e5"},
44
"dialyxir": {:hex, :dialyxir, "1.4.5", "ca1571ac18e0f88d4ab245f0b60fa31ff1b12cbae2b11bd25d207f865e8ae78a", [:mix], [{:erlex, ">= 0.2.7", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "b0fb08bb8107c750db5c0b324fa2df5ceaa0f9307690ee3c1f6ba5b9eb5d35c3"},
55
"earmark_parser": {:hex, :earmark_parser, "1.4.43", "34b2f401fe473080e39ff2b90feb8ddfeef7639f8ee0bbf71bb41911831d77c5", [:mix], [], "hexpm", "970a3cd19503f5e8e527a190662be2cee5d98eed1ff72ed9b3d1a3d466692de8"},
66
"erlex": {:hex, :erlex, "0.2.7", "810e8725f96ab74d17aac676e748627a07bc87eb950d2b83acd29dc047a30595", [:mix], [], "hexpm", "3ed95f79d1a844c3f6bf0cea61e0d5612a42ce56da9c03f01df538685365efb0"},
77
"ex_doc": {:hex, :ex_doc, "0.37.2", "2a3aa7014094f0e4e286a82aa5194a34dd17057160988b8509b15aa6c292720c", [:mix], [{:earmark_parser, "~> 1.4.42", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.0", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1 or ~> 1.0", [hex: :makeup_erlang, repo: "hexpm", optional: false]}, {:makeup_html, ">= 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: true]}], "hexpm", "4dfa56075ce4887e4e8b1dcc121cd5fcb0f02b00391fd367ff5336d98fa49049"},
8-
"file_system": {:hex, :file_system, "1.1.0", "08d232062284546c6c34426997dd7ef6ec9f8bbd090eb91780283c9016840e8f", [:mix], [], "hexpm", "bfcf81244f416871f2a2e15c1b515287faa5db9c6bcf290222206d120b3d43f6"},
8+
"file_system": {:hex, :file_system, "1.1.1", "31864f4685b0148f25bd3fbef2b1228457c0c89024ad67f7a81a3ffbc0bbad3a", [:mix], [], "hexpm", "7a15ff97dfe526aeefb090a7a9d3d03aa907e100e262a0f8f7746b78f8f87a5d"},
99
"finch": {:hex, :finch, "0.19.0", "c644641491ea854fc5c1bbaef36bfc764e3f08e7185e1f084e35e0672241b76d", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.6.2 or ~> 1.7", [hex: :mint, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.4 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 1.1", [hex: :nimble_pool, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "fc5324ce209125d1e2fa0fcd2634601c52a787aff1cd33ee833664a5af4ea2b6"},
1010
"ham": {:hex, :ham, "0.3.0", "7cd031b4a55fba219c11553e7b13ba73bd86eab4034518445eff1e038cb9a44d", [:mix], [], "hexpm", "7d6c6b73d7a6a83233876cc1b06a4d9b5de05562b228effda4532f9a49852bf6"},
1111
"hpax": {:hex, :hpax, "1.0.2", "762df951b0c399ff67cc57c3995ec3cf46d696e41f0bba17da0518d94acd4aac", [:mix], [], "hexpm", "2f09b4c1074e0abd846747329eaa26d535be0eb3d189fa69d812bfb8bfefd32f"},

0 commit comments

Comments
 (0)