Browse Source

removes cycle for appending all elements

Diego Alvarez 5 years ago
parent
commit
477ab8fc96
2 changed files with 2 additions and 6 deletions
  1. 1 3
      balance_strategy.go
  2. 1 3
      utils.go

+ 1 - 3
balance_strategy.go

@@ -956,9 +956,7 @@ func (p *partitionMovements) in(cycle []string, cycles [][]string) bool {
 	for i := 0; i < len(cycle)-1; i++ {
 		superCycle[i] = cycle[i]
 	}
-	for _, c := range cycle {
-		superCycle = append(superCycle, c)
-	}
+	superCycle = append(superCycle, cycle...)
 	for _, foundCycle := range cycles {
 		if len(foundCycle) == len(cycle) && indexOfSubList(superCycle, foundCycle) != -1 {
 			return true

+ 1 - 3
utils.go

@@ -26,9 +26,7 @@ func (slice int32Slice) Swap(i, j int) {
 
 func dupInt32Slice(input []int32) []int32 {
 	ret := make([]int32, 0, len(input))
-	for _, val := range input {
-		ret = append(ret, val)
-	}
+	ret = append(ret, input...)
 	return ret
 }