refactor: prefer orelse to if(pred) |x| x else y

This commit is contained in:
CJ van den Berg 2024-08-29 12:34:56 +02:00
parent 1caf2aa0f6
commit c01576412a
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
15 changed files with 43 additions and 43 deletions

View file

@ -48,7 +48,7 @@ pub fn Create(options: type) type {
pub const ButtonState = Button.State(*Menu.State(*Self));
pub fn create(a: std.mem.Allocator) !tui.Mode {
const mv = if (tui.current().mainview.dynamic_cast(mainview)) |mv_| mv_ else return error.NotFound;
const mv = tui.current().mainview.dynamic_cast(mainview) orelse return error.NotFound;
const self: *Self = try a.create(Self);
self.* = .{
.a = a,