Use early return

This commit is contained in:
Ivan Molodetskikh
2025-05-09 09:18:22 +03:00
parent 9ff2f83db0
commit b956f2775c
+5 -4
View File
@@ -3065,7 +3065,10 @@ impl State {
fn on_tablet_tool_tip<I: InputBackend>(&mut self, event: I::TabletToolTipEvent) { fn on_tablet_tool_tip<I: InputBackend>(&mut self, event: I::TabletToolTipEvent) {
let tool = self.niri.seat.tablet_seat().get_tool(&event.tool()); let tool = self.niri.seat.tablet_seat().get_tool(&event.tool());
if let Some(tool) = tool { let Some(tool) = tool else {
return;
};
let is_overview_open = self.niri.layout.is_overview_open(); let is_overview_open = self.niri.layout.is_overview_open();
match event.tip_state() { match event.tip_state() {
@@ -3076,8 +3079,7 @@ impl State {
if let Some(pos) = self.niri.tablet_cursor_location { if let Some(pos) = self.niri.tablet_cursor_location {
let under = self.niri.contents_under(pos); let under = self.niri.contents_under(pos);
if let Some((window, _)) = under.window { if let Some((window, _)) = under.window {
if let Some(output) = is_overview_open.then_some(under.output).flatten() if let Some(output) = is_overview_open.then_some(under.output).flatten() {
{
let mut workspaces = self.niri.layout.workspaces(); let mut workspaces = self.niri.layout.workspaces();
if let Some(ws_idx) = workspaces.find_map(|(_, ws_idx, ws)| { if let Some(ws_idx) = workspaces.find_map(|(_, ws_idx, ws)| {
ws.windows().any(|w| w.window == window).then_some(ws_idx) ws.windows().any(|w| w.window == window).then_some(ws_idx)
@@ -3117,7 +3119,6 @@ impl State {
} }
} }
} }
}
fn on_tablet_tool_proximity<I: InputBackend>(&mut self, event: I::TabletToolProximityEvent) fn on_tablet_tool_proximity<I: InputBackend>(&mut self, event: I::TabletToolProximityEvent)
where where