aboutsummaryrefslogtreecommitdiff
path: root/lib/std/meta
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
parentbaabc6013ea4f44082e69375214e76b5d803c5cb (diff)
downloadzig-51595d6b75d8ac2443a2c142c71f2a617c12fe96.tar.gz
zig-51595d6b75d8ac2443a2c142c71f2a617c12fe96.zip
lib: correct unnecessary uses of 'var'
Diffstat (limited to 'lib/std/meta')
-rw-r--r--lib/std/meta/trait.zig7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/std/meta/trait.zig b/lib/std/meta/trait.zig
index e00fac261c..3d3a1099fa 100644
--- a/lib/std/meta/trait.zig
+++ b/lib/std/meta/trait.zig
@@ -225,6 +225,7 @@ test "isSingleItemPtr" {
try comptime testing.expect(isSingleItemPtr(@TypeOf(&array[0])));
try comptime testing.expect(!isSingleItemPtr(@TypeOf(array)));
var runtime_zero: usize = 0;
+ _ = &runtime_zero;
try testing.expect(!isSingleItemPtr(@TypeOf(array[runtime_zero..1])));
}
@@ -253,6 +254,7 @@ pub fn isSlice(comptime T: type) bool {
test "isSlice" {
const array = [_]u8{0} ** 10;
var runtime_zero: usize = 0;
+ _ = &runtime_zero;
try testing.expect(isSlice(@TypeOf(array[runtime_zero..])));
try testing.expect(!isSlice(@TypeOf(array)));
try testing.expect(!isSlice(@TypeOf(&array[0])));
@@ -341,8 +343,9 @@ pub fn isConstPtr(comptime T: type) bool {
}
test "isConstPtr" {
- var t = @as(u8, 0);
- const c = @as(u8, 0);
+ var t: u8 = 0;
+ t = t;
+ const c: u8 = 0;
try testing.expect(isConstPtr(*const @TypeOf(t)));
try testing.expect(isConstPtr(@TypeOf(&c)));
try testing.expect(!isConstPtr(*@TypeOf(t)));