mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-08-27 17:41:40 +00:00
style: use decl literals
This commit changes a LOT of areas of the code to use decl literals instead of redundantly referring to the type. These changes were mostly driven by some regex searches and then manual adjustment on a case-by-case basis. I almost certainly missed quite a few places where decl literals could be used, but this is a good first step in converting things, and other instances can be addressed when they're discovered. I tested GLFW+Metal and building the framework on macOS and tested a GTK build on Linux, so I'm 99% sure I didn't introduce any syntax errors or other problems with this. (fingers crossed)
This commit is contained in:
@@ -155,17 +155,17 @@ pub const Parser = struct {
|
||||
break :action c;
|
||||
};
|
||||
const control: Command.Control = switch (action) {
|
||||
'q' => .{ .query = try Transmission.parse(self.kv) },
|
||||
't' => .{ .transmit = try Transmission.parse(self.kv) },
|
||||
'q' => .{ .query = try .parse(self.kv) },
|
||||
't' => .{ .transmit = try .parse(self.kv) },
|
||||
'T' => .{ .transmit_and_display = .{
|
||||
.transmission = try Transmission.parse(self.kv),
|
||||
.display = try Display.parse(self.kv),
|
||||
.transmission = try .parse(self.kv),
|
||||
.display = try .parse(self.kv),
|
||||
} },
|
||||
'p' => .{ .display = try Display.parse(self.kv) },
|
||||
'd' => .{ .delete = try Delete.parse(self.kv) },
|
||||
'f' => .{ .transmit_animation_frame = try AnimationFrameLoading.parse(self.kv) },
|
||||
'a' => .{ .control_animation = try AnimationControl.parse(self.kv) },
|
||||
'c' => .{ .compose_animation = try AnimationFrameComposition.parse(self.kv) },
|
||||
'p' => .{ .display = try .parse(self.kv) },
|
||||
'd' => .{ .delete = try .parse(self.kv) },
|
||||
'f' => .{ .transmit_animation_frame = try .parse(self.kv) },
|
||||
'a' => .{ .control_animation = try .parse(self.kv) },
|
||||
'c' => .{ .compose_animation = try .parse(self.kv) },
|
||||
else => return error.InvalidFormat,
|
||||
};
|
||||
|
||||
|
||||
@@ -324,7 +324,7 @@ fn loadAndAddImage(
|
||||
}
|
||||
|
||||
break :loading loading.*;
|
||||
} else try LoadingImage.init(alloc, cmd);
|
||||
} else try .init(alloc, cmd);
|
||||
|
||||
// We only want to deinit on error. If we're chunking, then we don't
|
||||
// want to deinit at all. If we're not chunking, then we'll deinit
|
||||
|
||||
Reference in New Issue
Block a user