diff --git a/lib/config/optionsconfiguration.go b/lib/config/optionsconfiguration.go index 6d732f306..eecf34dda 100644 --- a/lib/config/optionsconfiguration.go +++ b/lib/config/optionsconfiguration.go @@ -9,6 +9,7 @@ package config import ( "fmt" "runtime" + "slices" "github.com/syncthing/syncthing/lib/protocol" "github.com/syncthing/syncthing/lib/rand" @@ -268,13 +269,7 @@ func (opts OptionsConfiguration) AutoUpgradeEnabled() bool { } func (opts OptionsConfiguration) FeatureFlag(name string) bool { - for _, flag := range opts.FeatureFlags { - if flag == name { - return true - } - } - - return false + return slices.Contains(opts.FeatureFlags, name) } // LowestConnectionLimit is the lower of ConnectionLimitEnough or diff --git a/lib/model/devicedownloadstate.go b/lib/model/devicedownloadstate.go index 9fe3a3552..13059499a 100644 --- a/lib/model/devicedownloadstate.go +++ b/lib/model/devicedownloadstate.go @@ -7,6 +7,8 @@ package model import ( + "slices" + "github.com/syncthing/syncthing/lib/protocol" "github.com/syncthing/syncthing/lib/sync" ) @@ -40,12 +42,7 @@ func (p *deviceFolderDownloadState) Has(file string, version protocol.Vector, in return false } - for _, existingIndex := range local.blockIndexes { - if existingIndex == index { - return true - } - } - return false + return slices.Contains(local.blockIndexes, index) } // Update updates internal state of what has been downloaded into the temporary