chore: Fix remaining clippy lints

This commit is contained in:
Victoria Brekenfeld 2026-03-20 13:40:06 +01:00 committed by Victoria Brekenfeld
parent 0a016991a4
commit 5216eb50ba
14 changed files with 64 additions and 50 deletions

View file

@ -812,7 +812,7 @@ impl CosmicMapped {
scale.x,
0.8,
) {
Ok(element) => vec![CosmicMappedRenderElement::from(element).into()],
Ok(element) => vec![CosmicMappedRenderElement::from(element)],
Err(err) => {
debug!(?err, "Error rendering debug overlay.");
Vec::new()

View file

@ -154,6 +154,8 @@ impl Focus {
}
}
/// # Safety
/// `value` must be in the range of `Focus`
pub unsafe fn from_u8(value: u8) -> Option<Focus> {
match value {
0 => None,

View file

@ -61,6 +61,7 @@ pub enum PointerFocusTarget {
}
#[derive(Debug, Clone, PartialEq)]
#[allow(clippy::large_enum_variant)]
pub enum PointerFocusToplevel {
Surface(CosmicSurface),
Popup(PopupKind),

View file

@ -737,6 +737,8 @@ impl MoveGrab {
release: ReleaseMode,
evlh: LoopHandle<'static, State>,
) -> MoveGrab {
// false-positive: `Output`s hash is based on it's inner ptr
#[allow(clippy::mutable_key_type)]
let mut outputs = HashSet::new();
outputs.insert(cursor_output.clone());
window.output_enter(&cursor_output, window.geometry()); // not accurate but...
@ -798,6 +800,8 @@ impl Drop for MoveGrab {
// No more buttons are pressed, release the grab.
let output = self.cursor_output.clone();
let seat = self.seat.clone();
// false-positive: `Output`s hash is based on it's inner ptr
#[allow(clippy::mutable_key_type)]
let window_outputs = self.window_outputs.drain().collect::<HashSet<_>>();
let previous = self.previous;
let window = self.window.clone();

View file

@ -1459,35 +1459,32 @@ impl TilingLayout {
let _ = tree.remove_node(node.clone(), RemoveBehavior::DropChildren);
// fixup parent node
match parent_id {
Some(id) => {
let position = position.unwrap();
let group = tree.get_mut(&id).unwrap().data_mut();
assert!(group.is_group());
if let Some(id) = parent_id {
let position = position.unwrap();
let group = tree.get_mut(&id).unwrap().data_mut();
assert!(group.is_group());
if group.len() > 2 {
group.remove_window(position);
} else {
trace!("Removing Group");
let other_child = tree.children_ids(&id).unwrap().next().cloned().unwrap();
let fork_pos = parent_parent_id.as_ref().and_then(|parent_id| {
tree.children_ids(parent_id).unwrap().position(|i| i == &id)
});
let _ = tree.remove_node(id.clone(), RemoveBehavior::OrphanChildren);
tree.move_node(
&other_child,
parent_parent_id
.as_ref()
.map(MoveBehavior::ToParent)
.unwrap_or(MoveBehavior::ToRoot),
)
.unwrap();
if let Some(old_pos) = fork_pos {
tree.make_nth_sibling(&other_child, old_pos).unwrap();
}
if group.len() > 2 {
group.remove_window(position);
} else {
trace!("Removing Group");
let other_child = tree.children_ids(&id).unwrap().next().cloned().unwrap();
let fork_pos = parent_parent_id.as_ref().and_then(|parent_id| {
tree.children_ids(parent_id).unwrap().position(|i| i == &id)
});
let _ = tree.remove_node(id.clone(), RemoveBehavior::OrphanChildren);
tree.move_node(
&other_child,
parent_parent_id
.as_ref()
.map(MoveBehavior::ToParent)
.unwrap_or(MoveBehavior::ToRoot),
)
.unwrap();
if let Some(old_pos) = fork_pos {
tree.make_nth_sibling(&other_child, old_pos).unwrap();
}
}
None => {} // root
}
}

View file

@ -1186,6 +1186,8 @@ impl Workspaces {
let len = self.sets[0].workspaces.len();
let mut active = self.sets[0].active;
let mut keep = vec![true; len];
// false-positive: we iterate over multiple sets
#[allow(clippy::needless_range_loop)]
for i in 0..len {
let has_windows = self
.sets

View file

@ -319,6 +319,7 @@ pub struct FullscreenRestoreData {
}
#[derive(Debug, Clone, PartialEq)]
#[allow(clippy::large_enum_variant)]
pub enum FocusResult {
None,
Handled,