chore: Rust 2024 edition

Set the formatting style to 2021 edition to avoid disrupting existing work.
Remove when possible.
This commit is contained in:
Vukašin Vojinović 2025-07-21 14:56:53 +02:00 committed by Victoria Brekenfeld
parent 35d781dc1e
commit 7f7ab8bcbe
19 changed files with 494 additions and 506 deletions

View file

@ -667,8 +667,7 @@ impl CosmicMapped {
WindowSurface::Wayland(_) => "Protocol: Wayland",
WindowSurface::X11(_) => "Protocol: X11",
});
if let WindowSurface::X11(ref surf) =
window.0.underlying_surface()
if let WindowSurface::X11(surf) = window.0.underlying_surface()
{
let geo = surf.geometry();
ui.label(format!(

View file

@ -1,6 +1,6 @@
use super::{
CosmicSurface,
window::{Focus, RESIZE_BORDER},
CosmicSurface,
};
use crate::{
backend::render::cursor::CursorState,
@ -17,12 +17,11 @@ use crate::{
};
use calloop::LoopHandle;
use cosmic::{
Apply, Element as CosmicElement, Theme,
iced::{Alignment, id::Id, widget as iced_widget},
iced_core::{Background, Border, Color, Length, border::Radius},
iced::{id::Id, widget as iced_widget, Alignment},
iced_core::{border::Radius, Background, Border, Color, Length},
iced_runtime::Task,
iced_widget::scrollable::AbsoluteOffset,
theme, widget as cosmic_widget,
theme, widget as cosmic_widget, Apply, Element as CosmicElement, Theme,
};
use cosmic_settings_config::shortcuts;
use shortcuts::action::{Direction, FocusDirection};
@ -30,16 +29,15 @@ use smithay::{
backend::{
input::KeyState,
renderer::{
ImportAll, ImportMem, Renderer,
element::{
AsRenderElements, memory::MemoryRenderBufferRenderElement,
surface::WaylandSurfaceRenderElement,
memory::MemoryRenderBufferRenderElement, surface::WaylandSurfaceRenderElement,
AsRenderElements,
},
ImportAll, ImportMem, Renderer,
},
},
desktop::{WindowSurfaceType, space::SpaceElement},
desktop::{space::SpaceElement, WindowSurfaceType},
input::{
Seat,
keyboard::{KeyboardTarget, KeysymHandle, ModifiersState},
pointer::{
AxisFrame, ButtonEvent, CursorImageStatus, GestureHoldBeginEvent, GestureHoldEndEvent,
@ -51,6 +49,7 @@ use smithay::{
DownEvent, MotionEvent as TouchMotionEvent, OrientationEvent, ShapeEvent, TouchTarget,
UpEvent,
},
Seat,
},
output::Output,
reexports::wayland_server::protocol::wl_surface::WlSurface,
@ -63,8 +62,8 @@ use std::{
fmt,
hash::Hash,
sync::{
Arc, LazyLock, Mutex,
atomic::{AtomicBool, AtomicU8, AtomicUsize, Ordering},
Arc, LazyLock, Mutex,
},
};
@ -314,7 +313,11 @@ impl CosmicStack {
if let Ok(old) =
p.active
.fetch_update(Ordering::SeqCst, Ordering::SeqCst, |val| {
if val < max - 1 { Some(val + 1) } else { None }
if val < max - 1 {
Some(val + 1)
} else {
None
}
})
{
p.previous_keyboard.store(old, Ordering::SeqCst);

View file

@ -744,7 +744,7 @@ impl TilingLayout {
}
};
for (ref mut parent_id, _) in children.iter_mut() {
for (parent_id, _) in children.iter_mut() {
*parent_id = id.clone();
}
if let Data::Mapped { mapped, .. } = other_tree.get_mut(&id).unwrap().data_mut() {

View file

@ -3267,22 +3267,29 @@ impl Shell {
let is_stacked = mapped.is_stack();
if target_stack || !is_stacked {
Box::new(window_items(
&mapped,
is_tiled,
is_stacked,
is_sticky,
tiling_enabled,
edge,
config,
)) as Box<dyn Iterator<Item = Item>>
Box::new(
window_items(
&mapped,
is_tiled,
is_stacked,
is_sticky,
tiling_enabled,
edge,
config,
)
.collect::<Vec<Item>>()
.into_iter(),
) as Box<dyn Iterator<Item = Item>>
} else {
let (tab, _) = mapped
.windows()
.find(|(s, _)| s.wl_surface().as_deref() == Some(surface))
.unwrap();
Box::new(tab_items(&mapped, &tab, is_tiled, config))
as Box<dyn Iterator<Item = Item>>
Box::new(
tab_items(&mapped, &tab, is_tiled, config)
.collect::<Vec<Item>>()
.into_iter(),
) as Box<dyn Iterator<Item = Item>>
}
};
@ -3292,7 +3299,7 @@ impl Shell {
.mapped()
.find_map(|m| {
m.windows()
.find(|(ref w, _)| w == surface)
.find(|(w, _)| w == surface)
.map(|(_, loc)| (m, loc))
})
.map(|(mapped, relative_loc)| (set, mapped, relative_loc))