this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

all: minor code cleanups

While skimming the pkg/tool/cli code, I noticed that a switch
can be replaced by a boolean expression.

While here, apply three staticcheck suggestions around unused values.

Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
Change-Id: I02b2d768b1fc9176a5f0d913b2de1e9f5ab549ae
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1199478
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Reviewed-by: Matthew Sackman <matthew@cue.works>

+3 -8
-1
internal/core/compile/builtin.go
··· 24 24 const supportedByLen = adt.StructKind | adt.BytesKind | adt.StringKind | adt.ListKind 25 25 26 26 var ( 27 - stringParam = adt.Param{Value: &adt.BasicType{K: adt.StringKind}} 28 27 structParam = adt.Param{Value: &adt.BasicType{K: adt.StructKind}} 29 28 listParam = adt.Param{Value: &adt.BasicType{K: adt.ListKind}} 30 29 intParam = adt.Param{Value: &adt.BasicType{K: adt.IntKind}}
+1
internal/vcs/vcs_test.go
··· 138 138 err = os.WriteFile(filepath.Join(dir, "bar.txt"), []byte("something else"), 0o666) 139 139 qt.Assert(t, qt.IsNil(err)) 140 140 statuschanged, err := v.Status(ctx) 141 + qt.Assert(t, qt.IsNil(err)) 141 142 qt.Assert(t, qt.IsTrue(statuschanged.Uncommitted)) 142 143 status1, err := v.Status(ctx, subdir) 143 144 qt.Assert(t, qt.IsNil(err))
+1 -1
pkg/path/match.go
··· 103 103 // Before returning false with no error, 104 104 // check that the remainder of the pattern is syntactically valid. 105 105 for len(pattern) > 0 { 106 - _, chunk, pattern, err = scanChunk(pattern, os) 106 + _, _, pattern, err = scanChunk(pattern, os) 107 107 if err != nil { 108 108 return false, err 109 109 }
+1 -6
pkg/tool/cli/cli.go
··· 94 94 95 95 switch v := ctx.Lookup("response"); v.IncompleteKind() { 96 96 case cue.BoolKind: 97 - switch strings.ToLower(response) { 98 - case "yes": 99 - update["response"] = true 100 - default: 101 - update["response"] = false 102 - } 97 + update["response"] = strings.ToLower(response) == "yes" 103 98 case cue.StringKind: 104 99 // already set above 105 100 }