Redundant type conversion
Reports type conversions that may be omitted.
Example:
var s = string("hello")
The "hello"
value is the string
type already, the additional conversion to string
is redundant. To remove the conversion, consider using the Delete conversion quick-fix.
After the quick-fix is applied:
var s = "hello"
Sometimes conversion of a floating expression to a floating type can be intentional (see this issue as an example). In such cases, the IDE issues a warning about a possibly redundant conversion.
Inspection Details | |
---|---|
Available in: | GoLand 2023.3 |
Plugin: | Go, 233.SNAPSHOT |
Last modified: 13 July 2023