]> Cypherpunks repositories - gostls13.git/commitdiff
gofmt: remove redundant check in rewriter
authorRobert Griesemer <gri@golang.org>
Mon, 30 Jun 2014 21:40:12 +0000 (14:40 -0700)
committerRobert Griesemer <gri@golang.org>
Mon, 30 Jun 2014 21:40:12 +0000 (14:40 -0700)
If the actual types of two reflect values are
the same and the values are structs, they must
have the same number of fields.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/108280043

src/cmd/gofmt/rewrite.go

index fb6c6fc811af3b98b3397a8bba29c8b8cb5ad515..d267cfcc1dc69de69c51bb82e790e9a3ce4c786d 100644 (file)
@@ -226,9 +226,6 @@ func match(m map[string]reflect.Value, pattern, val reflect.Value) bool {
                return true
 
        case reflect.Struct:
-               if p.NumField() != v.NumField() {
-                       return false
-               }
                for i := 0; i < p.NumField(); i++ {
                        if !match(m, p.Field(i), v.Field(i)) {
                                return false