mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-21 02:01:55 +07:00
Fix new Clippy warnings
This commit is contained in:
+1
-1
@@ -1658,7 +1658,7 @@ impl Tty {
|
||||
.unwrap_or_else(|| {
|
||||
is_vrr_capable(&device.drm, connector.handle()) == Some(true)
|
||||
});
|
||||
let vrr_enabled = surface.map_or(false, |surface| surface.compositor.vrr_enabled());
|
||||
let vrr_enabled = surface.is_some_and(|surface| surface.compositor.vrr_enabled());
|
||||
|
||||
let logical = niri
|
||||
.global_space
|
||||
|
||||
+1
-1
@@ -155,7 +155,7 @@ impl PointerConstraintsHandler for State {
|
||||
location: Point<f64, Logical>,
|
||||
) {
|
||||
let is_constraint_active = with_pointer_constraint(surface, pointer, |constraint| {
|
||||
constraint.map_or(false, |c| c.is_active())
|
||||
constraint.is_some_and(|c| c.is_active())
|
||||
});
|
||||
|
||||
if !is_constraint_active {
|
||||
|
||||
+3
-3
@@ -119,7 +119,7 @@ impl State {
|
||||
.niri
|
||||
.exit_confirm_dialog
|
||||
.as_ref()
|
||||
.map_or(false, |d| d.is_open())
|
||||
.is_some_and(|d| d.is_open())
|
||||
&& should_hide_exit_confirm_dialog(&event);
|
||||
|
||||
use InputEvent::*;
|
||||
@@ -989,7 +989,7 @@ impl State {
|
||||
.niri
|
||||
.layout
|
||||
.active_output()
|
||||
.map_or(false, |active| output.as_ref() == Some(active));
|
||||
.is_some_and(|active| output.as_ref() == Some(active));
|
||||
|
||||
if let Some(output) = output {
|
||||
self.niri
|
||||
@@ -1010,7 +1010,7 @@ impl State {
|
||||
|
||||
// If we focused the target window.
|
||||
let new_focus = self.niri.layout.focus();
|
||||
if new_focus.map_or(false, |win| win.window == window) {
|
||||
if new_focus.is_some_and(|win| win.window == window) {
|
||||
self.maybe_warp_cursor_to_focus();
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -523,7 +523,7 @@ impl State {
|
||||
}
|
||||
|
||||
// Check if this workspace became active.
|
||||
let is_active = mon.map_or(false, |mon| mon.active_workspace_idx() == ws_idx);
|
||||
let is_active = mon.is_some_and(|mon| mon.active_workspace_idx() == ws_idx);
|
||||
if is_active && !ipc_ws.is_active {
|
||||
events.push(Event::WorkspaceActivated { id, focused: false });
|
||||
}
|
||||
@@ -546,7 +546,7 @@ impl State {
|
||||
idx: u8::try_from(ws_idx + 1).unwrap_or(u8::MAX),
|
||||
name: ws.name().cloned(),
|
||||
output: mon.map(|mon| mon.output_name().clone()),
|
||||
is_active: mon.map_or(false, |mon| mon.active_workspace_idx() == ws_idx),
|
||||
is_active: mon.is_some_and(|mon| mon.active_workspace_idx() == ws_idx),
|
||||
is_focused: Some(id) == focused_ws_id,
|
||||
active_window_id: ws.active_window().map(|win| win.id().get()),
|
||||
}
|
||||
|
||||
+8
-8
@@ -1194,7 +1194,7 @@ impl<W: LayoutElement> Layout<W> {
|
||||
mon.workspaces.iter().enumerate().find(|(_, w)| {
|
||||
w.name
|
||||
.as_ref()
|
||||
.map_or(false, |name| name.eq_ignore_ascii_case(workspace_name))
|
||||
.is_some_and(|name| name.eq_ignore_ascii_case(workspace_name))
|
||||
})
|
||||
{
|
||||
return Some((index, workspace));
|
||||
@@ -1205,7 +1205,7 @@ impl<W: LayoutElement> Layout<W> {
|
||||
if let Some((index, workspace)) = workspaces.iter().enumerate().find(|(_, w)| {
|
||||
w.name
|
||||
.as_ref()
|
||||
.map_or(false, |name| name.eq_ignore_ascii_case(workspace_name))
|
||||
.is_some_and(|name| name.eq_ignore_ascii_case(workspace_name))
|
||||
}) {
|
||||
return Some((index, workspace));
|
||||
}
|
||||
@@ -1229,7 +1229,7 @@ impl<W: LayoutElement> Layout<W> {
|
||||
WorkspaceReference::Name(ref_name) => ws
|
||||
.name
|
||||
.as_ref()
|
||||
.map_or(false, |name| name.eq_ignore_ascii_case(ref_name)),
|
||||
.is_some_and(|name| name.eq_ignore_ascii_case(ref_name)),
|
||||
WorkspaceReference::Id(id) => ws.id().get() == *id,
|
||||
WorkspaceReference::Index(_) => unreachable!(),
|
||||
})
|
||||
@@ -1657,7 +1657,7 @@ impl<W: LayoutElement> Layout<W> {
|
||||
monitor.workspaces.iter().any(|ws| {
|
||||
ws.name
|
||||
.as_ref()
|
||||
.map_or(false, |name| name.eq_ignore_ascii_case(workspace_name))
|
||||
.is_some_and(|name| name.eq_ignore_ascii_case(workspace_name))
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -2427,7 +2427,7 @@ impl<W: LayoutElement> Layout<W> {
|
||||
};
|
||||
|
||||
for mon in monitors {
|
||||
if output.map_or(false, |output| mon.output != *output) {
|
||||
if output.is_some_and(|output| mon.output != *output) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -2510,7 +2510,7 @@ impl<W: LayoutElement> Layout<W> {
|
||||
let Some(InteractiveMoveState::Moving(move_)) = self.interactive_move.take() else {
|
||||
unreachable!()
|
||||
};
|
||||
if output.map_or(false, |out| &move_.output != out) {
|
||||
if output.is_some_and(|out| &move_.output != out) {
|
||||
self.interactive_move = Some(InteractiveMoveState::Moving(move_));
|
||||
return;
|
||||
}
|
||||
@@ -4980,7 +4980,7 @@ mod tests {
|
||||
if ws
|
||||
.name
|
||||
.as_ref()
|
||||
.map_or(false, |name| name.eq_ignore_ascii_case(&ws_name))
|
||||
.is_some_and(|name| name.eq_ignore_ascii_case(&ws_name))
|
||||
{
|
||||
ws_id = Some(ws.id());
|
||||
}
|
||||
@@ -4998,7 +4998,7 @@ mod tests {
|
||||
if ws
|
||||
.name
|
||||
.as_ref()
|
||||
.map_or(false, |name| name.eq_ignore_ascii_case(&ws_name))
|
||||
.is_some_and(|name| name.eq_ignore_ascii_case(&ws_name))
|
||||
{
|
||||
ws_id = Some(ws.id());
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ impl<W: LayoutElement> Monitor<W> {
|
||||
self.workspaces.iter().find(|ws| {
|
||||
ws.name
|
||||
.as_ref()
|
||||
.map_or(false, |name| name.eq_ignore_ascii_case(workspace_name))
|
||||
.is_some_and(|name| name.eq_ignore_ascii_case(workspace_name))
|
||||
})
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ impl<W: LayoutElement> Monitor<W> {
|
||||
self.workspaces.iter().position(|ws| {
|
||||
ws.name
|
||||
.as_ref()
|
||||
.map_or(false, |name| name.eq_ignore_ascii_case(workspace_name))
|
||||
.is_some_and(|name| name.eq_ignore_ascii_case(workspace_name))
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1074,7 +1074,7 @@ impl<W: LayoutElement> Monitor<W> {
|
||||
return false;
|
||||
};
|
||||
|
||||
if is_touchpad.map_or(false, |x| gesture.is_touchpad != x) {
|
||||
if is_touchpad.is_some_and(|x| gesture.is_touchpad != x) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -2469,7 +2469,7 @@ impl<W: LayoutElement> ScrollingSpace<W> {
|
||||
return false;
|
||||
};
|
||||
|
||||
if is_touchpad.map_or(false, |x| gesture.is_touchpad != x) {
|
||||
if is_touchpad.is_some_and(|x| gesture.is_touchpad != x) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -3034,7 +3034,7 @@ impl TileData {
|
||||
self.interactively_resizing_by_left_edge = tile
|
||||
.window()
|
||||
.interactive_resize_data()
|
||||
.map_or(false, |data| data.edges.contains(ResizeEdge::LEFT));
|
||||
.is_some_and(|data| data.edges.contains(ResizeEdge::LEFT));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -3556,7 +3556,7 @@ impl Niri {
|
||||
.borrow()
|
||||
.outputs
|
||||
.find(name)
|
||||
.map_or(false, |output| output.is_vrr_on_demand());
|
||||
.is_some_and(|output| output.is_vrr_on_demand());
|
||||
if !on_demand {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user