diff options
author | Daniel Martí <mvdan@mvdan.cc> | 2018-03-24 15:49:43 +0000 |
---|---|---|
committer | Daniel Martí <mvdan@mvdan.cc> | 2018-03-24 19:44:47 +0000 |
commit | 8da180f6cac51f6cb8a316b962f797dbaf7ee96f (patch) | |
tree | 0dc75b1158d5c984d8c70e42228297fc75e97be6 /src/regexp | |
parent | b1892d740eaeddc46a0c735b472718149c438844 (diff) | |
download | go-8da180f6cac51f6cb8a316b962f797dbaf7ee96f.tar.gz go-8da180f6cac51f6cb8a316b962f797dbaf7ee96f.zip |
all: remove some unused return parameters
As found by unparam. Picked the low-hanging fruit, consisting only of
errors that were always nil and results that were never used. Left out
those that were useful for consistency with other func signatures.
Change-Id: I06b52bbd3541f8a5d66659c909bd93cb3e172018
Reviewed-on: https://go-review.googlesource.com/102418
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/regexp')
-rw-r--r-- | src/regexp/syntax/prog.go | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/regexp/syntax/prog.go b/src/regexp/syntax/prog.go index 6c56371b4c..36aa653b7f 100644 --- a/src/regexp/syntax/prog.go +++ b/src/regexp/syntax/prog.go @@ -122,15 +122,13 @@ func (p *Prog) String() string { return b.String() } -// skipNop follows any no-op or capturing instructions -// and returns the resulting pc. -func (p *Prog) skipNop(pc uint32) (*Inst, uint32) { +// skipNop follows any no-op or capturing instructions. +func (p *Prog) skipNop(pc uint32) *Inst { i := &p.Inst[pc] for i.Op == InstNop || i.Op == InstCapture { - pc = i.Out - i = &p.Inst[pc] + i = &p.Inst[i.Out] } - return i, pc + return i } // op returns i.Op but merges all the Rune special cases into InstRune @@ -147,7 +145,7 @@ func (i *Inst) op() InstOp { // regexp must start with. Complete is true if the prefix // is the entire match. func (p *Prog) Prefix() (prefix string, complete bool) { - i, _ := p.skipNop(uint32(p.Start)) + i := p.skipNop(uint32(p.Start)) // Avoid allocation of buffer if prefix is empty. if i.op() != InstRune || len(i.Rune) != 1 { @@ -158,7 +156,7 @@ func (p *Prog) Prefix() (prefix string, complete bool) { var buf bytes.Buffer for i.op() == InstRune && len(i.Rune) == 1 && Flags(i.Arg)&FoldCase == 0 { buf.WriteRune(i.Rune[0]) - i, _ = p.skipNop(i.Out) + i = p.skipNop(i.Out) } return buf.String(), i.Op == InstMatch } |