Skip to content

Commit 5c11084

Browse files
committed
ir: stylistic update
Remove use of msg format string variable for panic error message. This is to be consistent with other parts of the code that, e.g. From inst_conversion.go:41 panic(fmt.Errorf("trunc operands are not compatible: from=%v; to=%v", fromVectorT, to))
1 parent de8d3a2 commit 5c11084

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

ir/inst_conversion.go

+3-6
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ func NewTrunc(from value.Value, to types.Type) *InstTrunc {
4242
}
4343

4444
if fromVectorT.Len != toVectorT.Len {
45-
msg := "trunc vector operand length mismatch: from=%v; to=%v"
46-
panic(fmt.Errorf(msg, from.Type(), to))
45+
panic(fmt.Errorf("trunc vector operand length mismatch: from=%v; to=%v", from.Type(), to))
4746
}
4847

4948
fromType = fromVectorT.ElemType
@@ -53,14 +52,12 @@ func NewTrunc(from value.Value, to types.Type) *InstTrunc {
5352
if fromIntT, ok := fromType.(*types.IntType); ok {
5453
toIntT, ok := toType.(*types.IntType)
5554
if !ok {
56-
msg := "trunc operands are not compatible: from=%v; to=%T"
57-
panic(fmt.Errorf(msg, fromIntT, to))
55+
panic(fmt.Errorf("trunc operands are not compatible: from=%v; to=%T", fromIntT, to))
5856
}
5957
fromSize := fromIntT.BitSize
6058
toSize := toIntT.BitSize
6159
if fromSize < toSize {
62-
msg := "invalid trunc operands: from.BitSize < to.BitSize (%v is smaller than %v)"
63-
panic(fmt.Errorf(msg, from.Type(), to))
60+
panic(fmt.Errorf("invalid trunc operands: from.BitSize < to.BitSize (%v is smaller than %v)", from.Type(), to))
6461
}
6562
}
6663

0 commit comments

Comments
 (0)