From b48ad6dbfb31ce113313c3120fd98a19522da699 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sat, 24 Feb 2024 14:12:07 +0100 Subject: Make use of go≥1.21 slices package instead of hand-rolled loops MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes the code a tad smaller, moderner, and maybe even marginally faster, yay! --- internal/template/functions.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'internal/template/functions.go') diff --git a/internal/template/functions.go b/internal/template/functions.go index ef3ffd37..2db98420 100644 --- a/internal/template/functions.go +++ b/internal/template/functions.go @@ -8,6 +8,7 @@ import ( "html/template" "math" "net/mail" + "slices" "strings" "time" @@ -72,12 +73,7 @@ func (f *funcMap) Map() template.FuncMap { return link }, "mustBeProxyfied": func(mediaType string) bool { - for _, t := range config.Opts.ProxyMediaTypes() { - if t == mediaType { - return true - } - } - return false + return slices.Contains(config.Opts.ProxyMediaTypes(), mediaType) }, "domain": func(websiteURL string) string { return urllib.Domain(websiteURL) -- cgit v1.2.3