Skip to content

Commit 17dbde7

Browse files
refactor to simplify logic, remove unneeded var
1 parent a5c2a4c commit 17dbde7

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

evaluation/feature.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -297,10 +297,8 @@ func prereqsSatisfied(fc FeatureConfig, target *Target, flags map[string]Feature
297297
}
298298

299299
prereqsSatisfied := true
300-
satisfiedCount := 0
301300

302301
for _, pre := range fc.Prerequisites {
303-
304302
prereqFlag, ok := flags[pre.Feature]
305303
if !ok {
306304
continue
@@ -309,18 +307,14 @@ func prereqsSatisfied(fc FeatureConfig, target *Target, flags map[string]Feature
309307
variationToMatch := prereqFlag.Variations.FindByIdentifier(prereqFlag.GetVariationName(target))
310308

311309
if pre.Feature == prereqFlag.Feature {
312-
for _, x := range pre.Variations {
313-
if x == variationToMatch.Value {
314-
satisfiedCount++
310+
for _, variation := range pre.Variations {
311+
if variation != variationToMatch.Value {
312+
return false
315313
}
316314
}
317315
}
318316
}
319317

320-
if satisfiedCount != len(fc.Prerequisites) {
321-
prereqsSatisfied = false
322-
}
323-
324318
return prereqsSatisfied
325319
}
326320

0 commit comments

Comments
 (0)