diff options
author | Alexandr <aabruyako@gmail.com> | 2019-11-05 03:46:51 +0300 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2019-11-05 09:46:51 +0900 |
commit | b4cccf23d43fc1f8cffbc7cb73b68ef307b151ee (patch) | |
tree | 6336bb60d6e1d145c376bf5cdbf763059446c272 /src/algo | |
parent | b911af200c4ed4085a76d3e0a12458ccba2d3b3f (diff) |
Improvements to code quality and readability (#1737)
* Remove 1 unused field and 3 unused functions
unused elements fount by running
golangci-lint run --disable-all --enable unused
src/result.go:19:2: field `index` is unused (unused)
index int32
^
src/tui/light.go:716:23: func `(*LightWindow).stderr` is unused (unused)
func (w *LightWindow) stderr(str string) {
^
src/terminal.go:1015:6: func `numLinesMax` is unused (unused)
func numLinesMax(str string, max int) int {
^
src/tui/tui.go:167:20: func `ColorPair.is24` is unused (unused)
func (p ColorPair) is24() bool {
^
* Address warnings from "gosimple" linter
src/options.go:389:83: S1003: should use strings.Contains(str, ",,,") instead (gosimple)
if str == "," || strings.HasPrefix(str, ",,") || strings.HasSuffix(str, ",,") || strings.Index(str, ",,,") >= 0 {
^
src/options.go:630:18: S1007: should use raw string (`...`) with regexp.MustCompile to avoid having to escape twice (gosimple)
executeRegexp = regexp.MustCompile(
^
src/terminal.go:29:16: S1007: should use raw string (`...`) with regexp.MustCompile to avoid having to escape twice (gosimple)
placeholder = regexp.MustCompile("\\\\?(?:{[+sf]*[0-9,-.]*}|{q}|{\\+?f?nf?})")
^
src/terminal_test.go:92:10: S1007: should use raw string (`...`) with regexp.MustCompile to avoid having to escape twice (gosimple)
regex = regexp.MustCompile("\\w+")
^
* Address warnings from "staticcheck" linter
src/algo/algo.go:374:2: SA4006: this value of `offset32` is never used (staticcheck)
offset32, T := alloc32(offset32, slab, N)
^
src/algo/algo.go:456:2: SA4006: this value of `offset16` is never used (staticcheck)
offset16, C := alloc16(offset16, slab, width*M)
^
src/tui/tui.go:119:2: SA9004: only the first constant in this group has an explicit type (staticcheck)
colUndefined Color = -2
^
Diffstat (limited to 'src/algo')
-rw-r--r-- | src/algo/algo.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/algo/algo.go b/src/algo/algo.go index 2fe5c091..a627514c 100644 --- a/src/algo/algo.go +++ b/src/algo/algo.go @@ -371,7 +371,7 @@ func FuzzyMatchV2(caseSensitive bool, normalize bool, forward bool, input *util. // The first occurrence of each character in the pattern offset32, F := alloc32(offset32, slab, M) // Rune array - offset32, T := alloc32(offset32, slab, N) + _, T := alloc32(offset32, slab, N) input.CopyRunes(T) // Phase 2. Calculate bonus for each point @@ -453,7 +453,7 @@ func FuzzyMatchV2(caseSensitive bool, normalize bool, forward bool, input *util. copy(H, H0[f0:lastIdx+1]) // Possible length of consecutive chunk at each position. - offset16, C := alloc16(offset16, slab, width*M) + _, C := alloc16(offset16, slab, width*M) copy(C, C0[f0:lastIdx+1]) Fsub := F[1:] |