chore: manual clippy

This commit is contained in:
Vukašin Vojinović 2025-10-16 15:46:54 +02:00 committed by Victoria Brekenfeld
parent 0847247c33
commit 5e9ea93819
20 changed files with 253 additions and 291 deletions

View file

@ -241,7 +241,9 @@ impl CosmicMapped {
}
pub fn focus_window(&self, window: &CosmicSurface) {
if let CosmicMappedInternal::Stack(stack) = &self.element { stack.set_active(window) }
if let CosmicMappedInternal::Stack(stack) = &self.element {
stack.set_active(window)
}
}
pub fn has_surface(&self, surface: &WlSurface, surface_type: WindowSurfaceType) -> bool {
@ -480,17 +482,11 @@ impl CosmicMapped {
}
pub fn is_window(&self) -> bool {
match &self.element {
CosmicMappedInternal::Window(_) => true,
_ => false,
}
matches!(&self.element, CosmicMappedInternal::Window(_))
}
pub fn is_stack(&self) -> bool {
match &self.element {
CosmicMappedInternal::Stack(_) => true,
_ => false,
}
matches!(&self.element, CosmicMappedInternal::Stack(_))
}
pub fn stack_ref(&self) -> Option<&CosmicStack> {

View file

@ -544,12 +544,8 @@ impl CosmicStack {
}
pub fn pending_size(&self) -> Option<Size<i32, Logical>> {
self.0.with_program(|p| {
(*p.geometry
.lock()
.unwrap())
.map(|geo| geo.size.as_logical())
})
self.0
.with_program(|p| (*p.geometry.lock().unwrap()).map(|geo| geo.size.as_logical()))
}
pub fn set_geometry(&self, geo: Rectangle<i32, Global>) {
@ -1465,11 +1461,15 @@ impl PointerTarget<State> for CosmicStack {
}
fn axis(&self, seat: &Seat<State>, data: &mut State, frame: AxisFrame) {
if let Some(Focus::Header) = self.0.with_program(|p| p.current_focus()) { PointerTarget::axis(&self.0, seat, data, frame) }
if let Some(Focus::Header) = self.0.with_program(|p| p.current_focus()) {
PointerTarget::axis(&self.0, seat, data, frame)
}
}
fn frame(&self, seat: &Seat<State>, data: &mut State) {
if let Some(Focus::Header) = self.0.with_program(|p| p.current_focus()) { PointerTarget::frame(&self.0, seat, data) }
if let Some(Focus::Header) = self.0.with_program(|p| p.current_focus()) {
PointerTarget::frame(&self.0, seat, data)
}
}
fn leave(&self, seat: &Seat<State>, data: &mut State, serial: Serial, time: u32) {

View file

@ -93,7 +93,7 @@ impl PartialEq<ToplevelSurface> for CosmicSurface {
impl PartialEq<X11Surface> for CosmicSurface {
fn eq(&self, other: &X11Surface) -> bool {
self.x11_surface().map_or(false, |s| s == other)
self.x11_surface() == Some(other)
}
}
@ -278,8 +278,7 @@ impl CosmicSurface {
match self.0.underlying_surface() {
WindowSurface::Wayland(toplevel) => {
if enable {
let previous_decoration_state =
toplevel.current_state().decoration_mode;
let previous_decoration_state = toplevel.current_state().decoration_mode;
if PreferredDecorationMode::is_unset(&self.0) {
PreferredDecorationMode::update(&self.0, previous_decoration_state);
}