From a0a798f340a29680b4497e20368cd0f99a6c00b6 Mon Sep 17 00:00:00 2001 From: preciz Date: Thu, 24 Sep 2026 12:14:35 +0200 Subject: [PATCH] Avoid redundant guard checks when validating dates Call days_in_month_guarded/2 directly in Calendar.ISO.valid_date?/3 to skip redundant month and year guard checks and avoid intermediate call dispatch. Assisted-by: Antigravity:Gemini-Flash --- lib/elixir/lib/calendar/iso.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/elixir/lib/calendar/iso.ex b/lib/elixir/lib/calendar/iso.ex index 87f890cafb8..7cd4fa9168a 100644 --- a/lib/elixir/lib/calendar/iso.ex +++ b/lib/elixir/lib/calendar/iso.ex @@ -1728,7 +1728,7 @@ defmodule Calendar.ISO do @spec valid_date?(year, month, day) :: boolean def valid_date?(year, month, day) when is_integer(year) and is_integer(month) and is_integer(day) do - is_month(month) and day in 1..days_in_month(year, month) + is_month(month) and day in 1..days_in_month_guarded(year, month) end @doc """