Run modernize to rewrite some older go constructs to newer ones

Mostly using slice.Sort, using min/max, slices.Concat, range of int and
fmt.Appendf for byte slices instead of strings.
This commit is contained in:
Mechiel Lukkien
2025-03-06 17:33:06 +01:00
parent f6132bdbc0
commit 64f2f788b1
61 changed files with 146 additions and 232 deletions

View File

@ -11,6 +11,7 @@ import (
"github.com/mjl-/mox/message"
"github.com/mjl-/mox/store"
"slices"
)
// Search returns messages matching criteria specified in parameters.
@ -454,12 +455,7 @@ func (s *search) match0(sk searchKey) bool {
case "$mdnsent":
return s.m.MDNSent
default:
for _, k := range s.m.Keywords {
if k == kw {
return true
}
}
return false
return slices.Contains(s.m.Keywords, kw)
}
case "SEEN":
return s.m.Seen
@ -483,12 +479,7 @@ func (s *search) match0(sk searchKey) bool {
case "$mdnsent":
return !s.m.MDNSent
default:
for _, k := range s.m.Keywords {
if k == kw {
return false
}
}
return true
return !slices.Contains(s.m.Keywords, kw)
}
case "UNSEEN":
return !s.m.Seen