mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: replace calls to hasprefix with hasPrefix
The hasprefix function is redundant and can be removed since it has the same implementation as hasPrefix modulo variable names. Fixes #25688 Change-Id: I499cc24a2b5c38d1301718a4e66f555fd138386f Reviewed-on: https://go-review.googlesource.com/115835 Run-TryBot: Martin Möhrmann <moehrmann@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ilya Tocar <ilya.tocar@intel.com>
This commit is contained in:
parent
2fad8b219f
commit
b0dc54697b
7 changed files with 14 additions and 18 deletions
|
|
@ -333,7 +333,7 @@ func index(s, t string) int {
|
|||
return 0
|
||||
}
|
||||
for i := 0; i < len(s); i++ {
|
||||
if s[i] == t[0] && hasprefix(s[i:], t) {
|
||||
if s[i] == t[0] && hasPrefix(s[i:], t) {
|
||||
return i
|
||||
}
|
||||
}
|
||||
|
|
@ -344,8 +344,8 @@ func contains(s, t string) bool {
|
|||
return index(s, t) >= 0
|
||||
}
|
||||
|
||||
func hasprefix(s, t string) bool {
|
||||
return len(s) >= len(t) && s[:len(t)] == t
|
||||
func hasPrefix(s, prefix string) bool {
|
||||
return len(s) >= len(prefix) && s[:len(prefix)] == prefix
|
||||
}
|
||||
|
||||
const (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue