Pattern: Useless shift
Issue: -
This rule checks if shift or shift-assign operations shift by more than the length of the underlying variable. Update variable type or shift count to make your intention and code more clear.
Example of incorrect code:
func ShiftTest() {
var i8 int8
_ = i8 >> 8 // i8 is too small for shift of 8
}
Example of correct code:
func ShiftTest() {
var i8 int8
_ = i8 << 7
}