aboutsummaryrefslogtreecommitdiff
path: root/lib/std/meta.zig
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2023-11-10 05:27:17 +0000
committermlugg <mlugg@mlugg.co.uk>2023-11-19 09:55:07 +0000
commit51595d6b75d8ac2443a2c142c71f2a617c12fe96 (patch)
tree0e3045793aa36cc8569181cc790d270c4f056806 /lib/std/meta.zig
parentbaabc6013ea4f44082e69375214e76b5d803c5cb (diff)
downloadzig-51595d6b75d8ac2443a2c142c71f2a617c12fe96.tar.gz
zig-51595d6b75d8ac2443a2c142c71f2a617c12fe96.zip
lib: correct unnecessary uses of 'var'
Diffstat (limited to 'lib/std/meta.zig')
-rw-r--r--lib/std/meta.zig16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/std/meta.zig b/lib/std/meta.zig
index 75dee47fa7..827b8f847c 100644
--- a/lib/std/meta.zig
+++ b/lib/std/meta.zig
@@ -738,7 +738,7 @@ test "std.meta.TagPayload" {
},
};
const MovedEvent = TagPayload(Event, Event.Moved);
- var e: Event = undefined;
+ const e: Event = .{ .Moved = undefined };
try testing.expect(MovedEvent == @TypeOf(e.Moved));
}
@@ -839,9 +839,9 @@ test "std.meta.eql" {
try testing.expect(eql(u_1, u_3));
try testing.expect(!eql(u_1, u_2));
- var a1 = "abcdef".*;
- var a2 = "abcdef".*;
- var a3 = "ghijkl".*;
+ const a1 = "abcdef".*;
+ const a2 = "abcdef".*;
+ const a3 = "ghijkl".*;
try testing.expect(eql(a1, a2));
try testing.expect(!eql(a1, a3));
@@ -859,9 +859,9 @@ test "std.meta.eql" {
try testing.expect(!eql(EU.tst(false), EU.tst(true)));
const V = @Vector(4, u32);
- var v1: V = @splat(1);
- var v2: V = @splat(1);
- var v3: V = @splat(2);
+ const v1: V = @splat(1);
+ const v2: V = @splat(1);
+ const v3: V = @splat(2);
try testing.expect(eql(v1, v2));
try testing.expect(!eql(v1, v3));
@@ -879,6 +879,8 @@ test "intToEnum with error return" {
var zero: u8 = 0;
var one: u16 = 1;
+ _ = &zero;
+ _ = &one;
try testing.expect(intToEnum(E1, zero) catch unreachable == E1.A);
try testing.expect(intToEnum(E2, one) catch unreachable == E2.B);
try testing.expect(intToEnum(E3, zero) catch unreachable == E3.A);