Skip to content

Commit 17c5d0b

Browse files
committed
enable one more staticcheck check
Replace one append loop with an append, rewriting the comment which was inside the loop so that it still makes sense. While here, remove two unused fields which are low hanging fruit. Signed-off-by: Daniel Martí <[email protected]> Change-Id: I1861996e58e4fa5ce2338142a5688daef1f98590 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1207358 Reviewed-by: Roger Peppe <[email protected]> TryBot-Result: CUEcueckoo <[email protected]> Unity-Result: CUE porcuepine <[email protected]>
1 parent 2efb244 commit 17c5d0b

File tree

4 files changed

+7
-13
lines changed

4 files changed

+7
-13
lines changed

Diff for: cue/types_test.go

+3-5
Original file line numberDiff line numberDiff line change
@@ -2167,11 +2167,9 @@ func TestUnify(t *testing.T) {
21672167
// TestUnify2 is similar to TestUnify, but uses CompileString and Validate.
21682168
func TestUnify2(t *testing.T) {
21692169
type testCase struct {
2170-
name string
2171-
a string
2172-
b string
2173-
output string
2174-
err bool
2170+
a string
2171+
b string
2172+
err bool
21752173
}
21762174
testCases := []testCase{{
21772175
a: `null | close({})`,

Diff for: internal/core/adt/overlay.go

+3-6
Original file line numberDiff line numberDiff line change
@@ -242,12 +242,9 @@ func (ctx *overlayContext) cloneNodeContext(n *nodeContext) *nodeContext {
242242
// d.cyclicConjuncts = append(d.cyclicConjuncts, n.cyclicConjuncts...)
243243

244244
if len(n.disjunctions) > 0 {
245-
for _, de := range n.disjunctions {
246-
// Do not clone cc, as it is identified by underlying. We only need
247-
// to clone the cc in disjunctCCs.
248-
// de.cloneID.cc = ctx.allocCC(de.cloneID.cc)
249-
d.disjunctions = append(d.disjunctions, de)
250-
}
245+
// Do not clone cc in disjunctions, as it is identified by underlying.
246+
// We only need to clone the cc in disjunctCCs.
247+
d.disjunctions = append(d.disjunctions, n.disjunctions...)
251248
for _, h := range n.disjunctCCs {
252249
h.cc = ctx.allocCC(h.cc)
253250
d.disjunctCCs = append(d.disjunctCCs, h)

Diff for: internal/core/adt/sched.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ type task struct {
593593
// scheduler.
594594
blockedOn *scheduler
595595
blockCondition condition
596-
blockStack []*task // TODO: use; for error reporting.
596+
// blockStack []*task // TODO: use; for error reporting.
597597

598598
err *Bottom
599599

Diff for: staticcheck.conf

-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@ checks = [
55
"-SA1019", # use of deprecated APIs
66
"-SA4000", # identical expressions in && or || logic
77
"-S1008", # simplify if/else to bool expression
8-
"-S1011", # simplify loop with append
98
"-U1000", # unused code
109
]

0 commit comments

Comments
 (0)