use decl literals as suggested
Applied from the code review Co-authored-by: Leah Amelia Chen <github@acc.pluie.me>pull/8402/head
parent
e5ad6603f4
commit
0afadeea5f
|
|
@ -7210,9 +7210,7 @@ pub const QuickTerminalSize = struct {
|
|||
|
||||
pub const Type = enum(u8) { none, percentage, pixels };
|
||||
|
||||
fn none() CSize {
|
||||
return .{ .type = .none, .value = 0 };
|
||||
}
|
||||
pub const none: CSize = .{ .type = .none, .value = 0 };
|
||||
|
||||
fn percentage(v: f32) CSize {
|
||||
return .{ .type = .percentage, .value = @bitCast(v) };
|
||||
|
|
@ -7226,13 +7224,13 @@ pub const QuickTerminalSize = struct {
|
|||
pub fn cval(self: QuickTerminalSize) C {
|
||||
return .{
|
||||
.primary = if (self.primary) |p| switch (p) {
|
||||
.percentage => |v| CSize.percentage(v),
|
||||
.pixels => |v| CSize.pixels(v),
|
||||
} else CSize.none(),
|
||||
.percentage => |v| .percentage(v),
|
||||
.pixels => |v| .pixels(v),
|
||||
} else .none,
|
||||
.secondary = if (self.secondary) |s| switch (s) {
|
||||
.percentage => |v| CSize.percentage(v),
|
||||
.pixels => |v| CSize.pixels(v),
|
||||
} else CSize.none(),
|
||||
.percentage => |v| .percentage(v),
|
||||
.pixels => |v| .pixels(v),
|
||||
} else .none,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue