Z021: File-struct @This() alias
In file-as-struct patterns (files with top-level fields), the @This() alias should match the filename or be Self.
Examples
Bad
In a file named Config.zig:
// expect: Z021
const Wrong = @This();
value: u32,
name: []const u8,Good
Match the filename (in a file named Config.zig):
const Config = @This();
value: u32,
name: []const u8,
Or use Self:
const Self = @This();
value: u32,
name: []const u8,Rationale
When a file is structured as a type (with top-level fields), readers expect the @This() alias to match the filename. This makes it clear what type is being referenced. Self is also acceptable as it's a well-known Zig convention.