From 7dfc54b3e3c8d1fc4d983d9052a6b9f161402098 Mon Sep 17 00:00:00 2001 From: mkelvers Date: Sun, 5 Jul 2026 22:08:21 +0200 Subject: [PATCH] refactor: use slices.Contains for season validation --- internal/anime/simulcast.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/internal/anime/simulcast.go b/internal/anime/simulcast.go index 3398bfa1..3daa0090 100644 --- a/internal/anime/simulcast.go +++ b/internal/anime/simulcast.go @@ -4,6 +4,7 @@ import ( "context" "mal/integrations/jikan" "mal/internal/domain" + "slices" "strconv" "strings" ) @@ -92,13 +93,7 @@ func seasonNavigation(selected animeSeason, firstYear int, latest animeSeason) ( func seasonSelection(rawSeason, rawYear string, current, latest animeSeason) animeSeason { season := strings.ToLower(strings.TrimSpace(rawSeason)) - validSeason := false - for _, candidate := range seasons { - if season == candidate { - validSeason = true - break - } - } + validSeason := slices.Contains(seasons, season) year, err := strconv.Atoi(rawYear) if !validSeason || err != nil || year < 2000 || year > latest.Year || year == latest.Year && seasonIndex(season) > seasonIndex(latest.Season) { return current