chore: clippy

This commit is contained in:
Vukašin Vojinović 2025-10-16 13:50:32 +02:00 committed by Victoria Brekenfeld
parent 3b70bc0265
commit 0847247c33
77 changed files with 865 additions and 1029 deletions

View file

@ -51,9 +51,7 @@ fn next_workspace(
shell
.workspaces
.spaces_for_output(&output)
.skip_while(|space| space.handle != current_handle)
.skip(1)
.next()
.skip_while(|space| space.handle != current_handle).nth(1)
.map(|space| (current_handle, space.handle))
}
@ -62,7 +60,7 @@ fn move_fullscreen_prev_workspace(state: &mut State, surface: &CosmicSurface) {
let Some(wl_surface) = surface.wl_surface() else {
return;
};
let Some((from, to)) = prev_workspace(&shell, &*wl_surface) else {
let Some((from, to)) = prev_workspace(&shell, &wl_surface) else {
return;
};
@ -88,7 +86,7 @@ fn move_fullscreen_next_workspace(state: &mut State, surface: &CosmicSurface) {
let Some(wl_surface) = surface.wl_surface() else {
return;
};
let Some((from, to)) = next_workspace(&shell, &*wl_surface) else {
let Some((from, to)) = next_workspace(&shell, &wl_surface) else {
return;
};
@ -115,7 +113,7 @@ fn move_element_prev_workspace(state: &mut State, mapped: &CosmicMapped) {
let Some(wl_surface) = window.wl_surface() else {
return;
};
let Some((from, to)) = prev_workspace(&shell, &*wl_surface) else {
let Some((from, to)) = prev_workspace(&shell, &wl_surface) else {
return;
};
@ -141,7 +139,7 @@ fn move_element_next_workspace(state: &mut State, mapped: &CosmicMapped) {
let Some(wl_surface) = window.wl_surface() else {
return;
};
let Some((from, to)) = next_workspace(&shell, &*wl_surface) else {
let Some((from, to)) = next_workspace(&shell, &wl_surface) else {
return;
};

View file

@ -40,7 +40,7 @@ struct State {
cursor_over: bool,
}
impl<'a, Message> Widget<Message, cosmic::Theme, cosmic::Renderer> for SubmenuItem<'a, Message>
impl<Message> Widget<Message, cosmic::Theme, cosmic::Renderer> for SubmenuItem<'_, Message>
where
Message: CursorEvents,
{
@ -216,11 +216,11 @@ where
}
}
impl<'a, Message> Into<cosmic::Element<'a, Message>> for SubmenuItem<'a, Message>
impl<'a, Message> From<SubmenuItem<'a, Message>> for cosmic::Element<'a, Message>
where
Message: CursorEvents + 'a,
{
fn into(self) -> cosmic::Element<'a, Message> {
Element::new(self)
fn from(val: SubmenuItem<'a, Message>) -> Self {
Element::new(val)
}
}

View file

@ -381,7 +381,7 @@ impl Program for ContextMenu {
.row_width
.lock()
.unwrap()
.map(|size| Length::Fixed(size))
.map(Length::Fixed)
.unwrap_or(Length::Shrink);
let mode = match width {
Length::Shrink => Length::Shrink,
@ -968,8 +968,7 @@ impl MenuAlignment {
size,
AxisAlignment::Centered,
AxisAlignment::Corner(0),
)
.into_iter(),
),
)
.chain(
for_alignment(
@ -977,8 +976,7 @@ impl MenuAlignment {
size,
AxisAlignment::Corner(0),
AxisAlignment::Centered,
)
.into_iter(),
),
)
.chain(
for_alignment(
@ -986,15 +984,14 @@ impl MenuAlignment {
size,
AxisAlignment::Corner(0),
AxisAlignment::Corner(0),
)
.into_iter(),
),
)
.collect(),
(AxisAlignment::PreferCentered, y) => {
for_alignment(position, size, AxisAlignment::Centered, y)
.into_iter()
.chain(
for_alignment(position, size, AxisAlignment::Corner(0), y).into_iter(),
for_alignment(position, size, AxisAlignment::Corner(0), y),
)
.collect()
}
@ -1002,7 +999,7 @@ impl MenuAlignment {
for_alignment(position, size, x, AxisAlignment::Centered)
.into_iter()
.chain(
for_alignment(position, size, x, AxisAlignment::Corner(0)).into_iter(),
for_alignment(position, size, x, AxisAlignment::Corner(0)),
)
.collect()
}

View file

@ -122,9 +122,9 @@ impl From<shortcuts::action::ResizeEdge> for ResizeEdge {
}
}
impl Into<shortcuts::action::ResizeEdge> for ResizeEdge {
fn into(self) -> shortcuts::action::ResizeEdge {
match self {
impl From<ResizeEdge> for shortcuts::action::ResizeEdge {
fn from(val: ResizeEdge) -> Self {
match val {
ResizeEdge::BOTTOM => shortcuts::action::ResizeEdge::Bottom,
ResizeEdge::BOTTOM_LEFT => shortcuts::action::ResizeEdge::BottomLeft,
ResizeEdge::BOTTOM_RIGHT => shortcuts::action::ResizeEdge::BottomRight,

View file

@ -92,11 +92,10 @@ impl MoveGrabState {
let mut window_geo = self.window.geometry();
window_geo.loc += self.location.to_i32_round() + self.window_offset;
if !output
if output
.geometry()
.as_logical()
.intersection(window_geo)
.is_some()
.intersection(window_geo).is_none()
{
return Vec::new();
}
@ -136,15 +135,14 @@ impl MoveGrabState {
active_window_hint.green,
active_window_hint.blue,
],
))
.into(),
)),
)
} else {
None
};
let non_exclusive_geometry = {
let layers = layer_map_for_output(&output);
let layers = layer_map_for_output(output);
layers.non_exclusive_zone()
};
@ -173,8 +171,7 @@ impl MoveGrabState {
active_window_hint.green,
active_window_hint.blue,
],
))
.into(),
)),
CosmicMappedRenderElement::from(BackdropShader::element(
renderer,
Key::Window(Usage::SnappingIndicator, self.window.key()),
@ -182,8 +179,7 @@ impl MoveGrabState {
theme.radius_s()[0], // TODO: Fix once shaders support 4 corner radii customization
0.4,
[base_color.red, base_color.green, base_color.blue],
))
.into(),
)),
]
}
_ => vec![],
@ -431,7 +427,7 @@ impl MoveGrab {
indicator.output_enter(output, overlap);
}
}
} else if self.window_outputs.remove(&output) {
} else if self.window_outputs.remove(output) {
self.window.output_leave(output);
if let Some(indicator) = grab_state.stacking_indicator.as_ref().map(|x| &x.0) {
indicator.output_leave(output);
@ -440,7 +436,7 @@ impl MoveGrab {
}
let indicator_location =
shell.stacking_indicator(&current_output, self.previous.clone());
shell.stacking_indicator(&current_output, self.previous);
if indicator_location.is_some() != grab_state.stacking_indicator.is_some() {
grab_state.stacking_indicator = indicator_location.map(|geo| {
let element = stack_hover(
@ -739,7 +735,7 @@ impl MoveGrab {
start: Instant::now(),
stacking_indicator: None,
snapping_zone: None,
previous: previous_layer.clone(),
previous: previous_layer,
location: start_data.location(),
cursor_output: cursor_output.clone(),
};
@ -787,7 +783,7 @@ impl Drop for MoveGrab {
let output = self.cursor_output.clone();
let seat = self.seat.clone();
let window_outputs = self.window_outputs.drain().collect::<HashSet<_>>();
let previous = self.previous.clone();
let previous = self.previous;
let window = self.window.clone();
let is_touch_grab = matches!(self.start_data, GrabStartData::Touch(_));