Commit bbab5e19b4

daurnimator <quae@daurnimator.com>
2020-12-13 13:14:51
std: loop in trailer flags can be indexing operation
1 parent 4387e50
Changed files (1)
lib
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 {