• fix some typos
• remove superfluous conversions/parentheses
• remove superfluous nil checks
Change-Id: I428bf6a7be551b79270567047878c3076dd6f2ff
GitHub-Last-Rev:
3b1c7573cfdf89ac184fd6ae44bca4be78b0cd64
GitHub-Pull-Request: golang/go#45799
Reviewed-on: https://go-review.googlesource.com/c/go/+/314069
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
packages map[string]*types.Package
}
-// NewImporter returns a new Importer for the given context, file set, and map
+// New returns a new Importer for the given context, file set, and map
// of packages. The context is used to resolve import paths to package paths,
// and identifying the files belonging to the package. If the context provides
// non-nil file system functions, they are used instead of the regular package
if s[1] == "HERE" {
pos = here
}
- errors[pos] = string(s[2])
+ errors[pos] = s[2]
}
case token.SEMICOLON:
// don't use the position of auto-inserted (invisible) semicolons
rbrack := p.expect(token.RBRACK)
tparams = &ast.FieldList{Opening: opening, List: list, Closing: rbrack}
// Type parameter lists must not be empty.
- if tparams != nil && tparams.NumFields() == 0 {
+ if tparams.NumFields() == 0 {
p.error(tparams.Closing, "empty type parameter list")
tparams = nil // avoid follow-on errors
}
// ----------------------------------------------------------------------------
// Printing interface
-// nlines limits n to maxNewlines.
+// nlimit limits n to maxNewlines.
func nlimit(n int) int {
if n > maxNewlines {
n = maxNewlines
i++
}
}
- (*p) = (*p)[0:i]
+ *p = (*p)[0:i]
}
// An ErrorList implements the error interface.
if s.ch == '_' {
ds = 2
} else if s.ch >= max && *invalid < 0 {
- *invalid = int(s.offset) // record invalid rune offset
+ *invalid = s.offset // record invalid rune offset
}
digsep |= ds
s.next()
}
// At least one type argument couldn't be inferred.
- assert(targs != nil && index >= 0 && targs[index] == nil)
+ assert(index >= 0 && targs[index] == nil)
tpar := tparams[index]
if report {
check.errorf(posn, _Todo, "cannot infer %s (%v) (%v)", tpar.name, tpar.pos, targs)