From bbab5e19b45436f9828ae988832c1e31b5861683 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Sun, 13 Dec 2020 23:14:51 +1100 Subject: [PATCH] std: loop in trailer flags can be indexing operation --- lib/std/meta/trailer_flags.zig | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/std/meta/trailer_flags.zig b/lib/std/meta/trailer_flags.zig index 09c75b3d78..a5882d9e1b 100644 --- a/lib/std/meta/trailer_flags.zig +++ b/lib/std/meta/trailer_flags.zig @@ -122,10 +122,7 @@ pub fn TrailerFlags(comptime Fields: type) type { } pub fn Field(comptime field: FieldEnum) type { - inline for (@typeInfo(Fields).Struct.fields) |field_info, i| { - if (i == @enumToInt(field)) - return field_info.field_type; - } + return @typeInfo(Fields).Struct.fields[@enumToInt(field)].field_type; } pub fn sizeInBytes(self: Self) usize {