Commit 062406bc authored by Ryan Hitchman's avatar Ryan Hitchman Committed by Robert Griesemer

throughout: simplify two-variable ranges with unused second variable

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/3529041
parent 14804a41
...@@ -1182,7 +1182,7 @@ func (h *httpHandler) getPageInfo(abspath, relpath, pkgname string, mode PageInf ...@@ -1182,7 +1182,7 @@ func (h *httpHandler) getPageInfo(abspath, relpath, pkgname string, mode PageInf
// (excluding the selected package, if any). // (excluding the selected package, if any).
plist = make([]string, len(pkgs)) plist = make([]string, len(pkgs))
i := 0 i := 0
for name, _ := range pkgs { for name := range pkgs {
if pkg == nil || name != pkg.Name { if pkg == nil || name != pkg.Name {
plist[i] = name plist[i] = name
i++ i++
......
...@@ -20,7 +20,7 @@ func s(n uint64) string { ...@@ -20,7 +20,7 @@ func s(n uint64) string {
lens := len(str) lens := len(str)
a := make([]string, (lens+2)/3) a := make([]string, (lens+2)/3)
start := lens start := lens
for i, _ := range a { for i := range a {
start -= 3 start -= 3
if start < 0 { if start < 0 {
start = 0 start = 0
......
...@@ -268,7 +268,7 @@ func drawFillSrc(dst *image.RGBA, r image.Rectangle, src *image.ColorImage) { ...@@ -268,7 +268,7 @@ func drawFillSrc(dst *image.RGBA, r image.Rectangle, src *image.ColorImage) {
dbase := dy0 * dst.Stride dbase := dy0 * dst.Stride
i0, i1 := dbase+dx0, dbase+dx1 i0, i1 := dbase+dx0, dbase+dx1
firstRow := dst.Pix[i0:i1] firstRow := dst.Pix[i0:i1]
for i, _ := range firstRow { for i := range firstRow {
firstRow[i] = color firstRow[i] = color
} }
for y := dy0 + 1; y < dy1; y++ { for y := dy0 + 1; y < dy1; y++ {
......
...@@ -104,7 +104,7 @@ func TestParse4(t *testing.T) { ...@@ -104,7 +104,7 @@ func TestParse4(t *testing.T) {
t.Errorf(`package "parser" not found`) t.Errorf(`package "parser" not found`)
return return
} }
for filename, _ := range pkg.Files { for filename := range pkg.Files {
if !nameFilter(filename) { if !nameFilter(filename) {
t.Errorf("unexpected package file: %s", filename) t.Errorf("unexpected package file: %s", filename)
} }
......
...@@ -108,7 +108,7 @@ func (t *transferWriter) WriteHeader(w io.Writer) (err os.Error) { ...@@ -108,7 +108,7 @@ func (t *transferWriter) WriteHeader(w io.Writer) (err os.Error) {
// writing long headers, using HTTP line splitting // writing long headers, using HTTP line splitting
io.WriteString(w, "Trailer: ") io.WriteString(w, "Trailer: ")
needComma := false needComma := false
for k, _ := range t.Trailer { for k := range t.Trailer {
k = CanonicalHeaderKey(k) k = CanonicalHeaderKey(k)
switch k { switch k {
case "Transfer-Encoding", "Trailer", "Content-Length": case "Transfer-Encoding", "Trailer", "Content-Length":
......
...@@ -40,7 +40,7 @@ type Index struct { ...@@ -40,7 +40,7 @@ type Index struct {
// //
func New(data []byte) *Index { func New(data []byte) *Index {
sa := make([]int, len(data)) sa := make([]int, len(data))
for i, _ := range sa { for i := range sa {
sa[i] = i sa[i] = i
} }
x := &Index{data, sa} x := &Index{data, sa}
......
...@@ -550,7 +550,7 @@ func (t *StructType) fieldByNameFunc(match func(string) bool, mark map[*StructTy ...@@ -550,7 +550,7 @@ func (t *StructType) fieldByNameFunc(match func(string) bool, mark map[*StructTy
var fi int // field index var fi int // field index
n := 0 // number of matching fields at depth fd n := 0 // number of matching fields at depth fd
L: L:
for i, _ := range t.fields { for i := range t.fields {
f := t.Field(i) f := t.Field(i)
d := inf d := inf
switch { switch {
......
...@@ -326,7 +326,7 @@ func printCategories() { ...@@ -326,7 +326,7 @@ func printCategories() {
if *tablelist == "all" { if *tablelist == "all" {
fmt.Println("// Categories is the set of Unicode data tables.") fmt.Println("// Categories is the set of Unicode data tables.")
fmt.Println("var Categories = map[string] []Range {") fmt.Println("var Categories = map[string] []Range {")
for k, _ := range category { for k := range category {
fmt.Printf("\t%q: %s,\n", k, k) fmt.Printf("\t%q: %s,\n", k, k)
} }
fmt.Print("}\n\n") fmt.Print("}\n\n")
...@@ -594,7 +594,7 @@ func printScriptOrProperty(doProps bool) { ...@@ -594,7 +594,7 @@ func printScriptOrProperty(doProps bool) {
fmt.Println("// Scripts is the set of Unicode script tables.") fmt.Println("// Scripts is the set of Unicode script tables.")
fmt.Println("var Scripts = map[string] []Range {") fmt.Println("var Scripts = map[string] []Range {")
} }
for k, _ := range table { for k := range table {
fmt.Printf("\t%q: %s,\n", k, k) fmt.Printf("\t%q: %s,\n", k, k)
} }
fmt.Print("}\n\n") fmt.Print("}\n\n")
......
...@@ -77,7 +77,7 @@ func main() { ...@@ -77,7 +77,7 @@ func main() {
if out != "123" {panic(out)} if out != "123" {panic(out)}
sum := 0 sum := 0
for s, _ := range ints { for s := range ints {
sum += s sum += s
} }
if sum != 3 {panic(sum)} if sum != 3 {panic(sum)}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment