| package appendclipped |
| |
| import ( |
| "os" |
| "slices" |
| ) |
| |
| type Bytes []byte |
| |
| func _(s, other []string) { |
| print(slices.Clone(s)) // want "Replace append with slices.Clone" |
| print(slices.Clone(s)) // want "Replace append with slices.Clone" |
| print(slices.Clone(Bytes{1, 2, 3})) // want "Replace append with slices.Clone" |
| print(slices.Clone(s)) // want "Replace append with slices.Clone" |
| print(os.Environ()) // want "Redundant clone of os.Environ()" |
| print(append(other[:0], s...)) // nope: intent may be to mutate other |
| |
| print(slices.Concat(s, other, other)) // want "Replace append with slices.Concat" |
| print(slices.Concat(s, other, other)) // want "Replace append with slices.Concat" |
| print(slices.Concat(Bytes{1, 2, 3}, Bytes{4, 5, 6})) // want "Replace append with slices.Concat" |
| print(slices.Concat(s, other, other)) // want "Replace append with slices.Concat" |
| print(slices.Concat(os.Environ(), other, other)) // want "Replace append with slices.Concat" |
| print(slices.Concat(other, s, other)) // want "Replace append with slices.Concat" |
| print(slices.Concat(other, s, other)) // want "Replace append with slices.Concat" |
| print(append(append(append(other[:0], s...), other...), other...)) // nope: intent may be to mutate other |
| } |