From 90779c49aac9ac85d808922ff0c10a69e56608af Mon Sep 17 00:00:00 2001 From: Guilherme Andrade Date: Sat, 14 Oct 2023 18:44:38 +0100 Subject: [PATCH] Work around compilation warning on OTP 25 or older --- lib/sqids/agent.ex | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/sqids/agent.ex b/lib/sqids/agent.ex index a033c66..1974dd4 100644 --- a/lib/sqids/agent.ex +++ b/lib/sqids/agent.ex @@ -99,10 +99,13 @@ defmodule Sqids.Agent do # Use proc_lib:init_fail/2 instead of {:stop, reason} to avoid # polluting the logs: our supervisor will fail to start us and this # will already produce log messages with the relevant info. - :proc_lib.init_fail(error, {:exit, :normal}) + + # Use apply/3 to avoid compilation warnings on OTP 25 or older. + # credo:disable-for-next-line Credo.Check.Refactor.Apply + apply(:proc_lib, :init_fail, [error, {:exit, :normal}]) catch :error, :undef -> - # Fallback for pre- OTP 26 + # Fallback for OTP 25 or older server_name = server_name(sqids_module) Process.unregister(server_name) :proc_lib.init_ack(error)