Skip to content

Commit 852840f

Browse files
committed
cargo clippy --fix
1 parent c264093 commit 852840f

16 files changed

+79
-82
lines changed

src/drawing.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use smithay::{
1111
},
1212
input::pointer::CursorImageStatus,
1313
render_elements,
14-
utils::{Clock, Monotonic, Physical, Point, Scale},
14+
utils::{Physical, Point, Scale},
1515
};
1616
#[cfg(feature = "debug")]
1717
use smithay::{
@@ -32,7 +32,6 @@ pub struct PointerElement<T: Texture> {
3232
texture: Option<TextureBuffer<T>>,
3333
status: CursorImageStatus,
3434
cursor_manager: Cursor,
35-
clock: Clock<Monotonic>,
3635
}
3736

3837
impl<T: Texture> Default for PointerElement<T> {
@@ -41,7 +40,6 @@ impl<T: Texture> Default for PointerElement<T> {
4140
texture: Default::default(),
4241
status: CursorImageStatus::default_named(),
4342
cursor_manager: Cursor::load(),
44-
clock: Clock::new(),
4543
}
4644
}
4745
}
@@ -207,10 +205,10 @@ where
207205
fn draw(
208206
&self,
209207
frame: &mut <R as Renderer>::Frame<'_>,
210-
src: Rectangle<f64, Buffer>,
208+
_src: Rectangle<f64, Buffer>,
211209
dst: Rectangle<i32, Physical>,
212210
damage: &[Rectangle<i32, Physical>],
213-
opaque_regions: &[Rectangle<i32, Physical>],
211+
_opaque_regions: &[Rectangle<i32, Physical>],
214212
) -> Result<(), R::Error> {
215213
// FIXME: respect the src for cropping
216214
let scale = dst.size.to_f64() / self.src().size;

src/focus.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ impl<BackendData: Backend> WaylandFocus for KeyboardFocusTarget<BackendData> {
569569
KeyboardFocusTarget::Window(w) => w.wl_surface(),
570570
KeyboardFocusTarget::LayerSurface(l) => Some(Cow::Borrowed(l.wl_surface())),
571571
KeyboardFocusTarget::Popup(p) => Some(Cow::Borrowed(p.wl_surface())),
572-
KeyboardFocusTarget::View(d) => None,
572+
KeyboardFocusTarget::View(_) => None,
573573
}
574574
}
575575
}

src/input_handler.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -620,10 +620,10 @@ impl<Backend: crate::state::Backend> ScreenComposer<Backend> {
620620
let pos = evt.position_transformed(output_geo.size) + output_geo.loc.to_f64();
621621
let serial = SCOUNTER.next_serial();
622622

623-
let mut under = None;
623+
// let mut under = None;
624624
let pointer = self.pointer.clone();
625625
// if !self.workspace.get_show_all() {
626-
under = self.surface_under(pos);
626+
let under = self.surface_under(pos);
627627
// }
628628
// println!("Pointer move absolute: {:?}", pos);
629629
pointer.motion(

src/shell/element.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,18 +160,16 @@ impl WaylandFocus for SSD {
160160

161161
impl SpaceElement for WindowElement {
162162
fn geometry(&self) -> Rectangle<i32, Logical> {
163-
let geo = SpaceElement::geometry(&self.0);
164163
// if self.decoration_state().is_ssd {
165164
// geo.size.h += HEADER_BAR_HEIGHT;
166165
// }
167-
geo
166+
SpaceElement::geometry(&self.0)
168167
}
169168
fn bbox(&self) -> Rectangle<i32, Logical> {
170-
let bbox = SpaceElement::bbox(&self.0);
171169
// if self.decoration_state().is_ssd {
172170
// bbox.size.h += HEADER_BAR_HEIGHT;
173171
// }
174-
bbox
172+
SpaceElement::bbox(&self.0)
175173
}
176174
fn is_in_input_region(&self, point: &Point<f64, Logical>) -> bool {
177175
// if self.decoration_state().is_ssd {
@@ -233,7 +231,7 @@ where
233231
scale: Scale<f64>,
234232
alpha: f32,
235233
) -> Vec<C> {
236-
let window_bbox = SpaceElement::bbox(&self.0);
234+
let _window_bbox = SpaceElement::bbox(&self.0);
237235

238236
// if self.decoration_state().is_ssd && !window_bbox.is_empty() {
239237
// let window_geo = SpaceElement::geometry(&self.0);

src/shell/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ fn fullscreen_output_geometry(
6969
.unwrap_or(false)
7070
})
7171
.cloned();
72-
w.and_then(|w| space.outputs_for_element(&w).get(0).cloned())
72+
w.and_then(|w| space.outputs_for_element(&w).first().cloned())
7373
})
7474
.and_then(|o| space.output_geometry(&o))
7575
}

src/shell/xdg.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -300,16 +300,16 @@ impl<BackendData: Backend> XdgShellHandler for ScreenComposer<BackendData> {
300300
}
301301
}
302302

303-
let surface_clone = surface.clone();
303+
let _surface_clone = surface.clone();
304304
use std::borrow::Cow;
305305

306306
let window = self
307307
.space
308308
.elements()
309-
.find(|element| element.wl_surface().map(|s| s) == Some(Cow::Borrowed(&surface)));
310-
if let Some(window) = window {
309+
.find(|element| element.wl_surface() == Some(Cow::Borrowed(&surface)));
310+
if let Some(_window) = window {
311311
use xdg_decoration::zv1::server::zxdg_toplevel_decoration_v1::Mode;
312-
let is_ssd = configure
312+
let _is_ssd = configure
313313
.state
314314
.decoration_mode
315315
.map(|mode| mode == Mode::ServerSide)
@@ -435,7 +435,7 @@ impl<BackendData: Backend> XdgShellHandler for ScreenComposer<BackendData> {
435435
self.space.map_element(window, geometry.loc, true);
436436

437437
let id = surface.wl_surface().id();
438-
if let Some(window_layer_id) = self.workspace.windows_layer.id() {
438+
if let Some(_window_layer_id) = self.workspace.windows_layer.id() {
439439
if let Some(view) = self.get_window_view(&id) {
440440
view.layer.set_position(
441441
layers::types::Point {
@@ -470,7 +470,7 @@ impl<BackendData: Backend> XdgShellHandler for ScreenComposer<BackendData> {
470470
let id = surface.wl_surface().id();
471471
let window = self.window_for_surface(surface.wl_surface()).unwrap();
472472

473-
if let Some(window_layer_id) = self.workspace.windows_layer.id() {
473+
if let Some(_window_layer_id) = self.workspace.windows_layer.id() {
474474
let scale = self
475475
.space
476476
.outputs_for_element(&window)

src/skia_renderer.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use smithay::{
2929
format::{fourcc_to_gl_formats, gl_internal_format_to_fourcc},
3030
Capability, GlesError, GlesRenderbuffer, GlesRenderer, GlesTexture,
3131
},
32-
sync::{Fence, SyncPoint},
32+
sync::SyncPoint,
3333
Bind, Color32F, DebugFlags, ExportMem, Frame, ImportDma, ImportDmaWl, ImportEgl,
3434
ImportMem, ImportMemWl, Offscreen, Renderer, Texture, TextureFilter, TextureMapping,
3535
Unbind,
@@ -64,7 +64,7 @@ impl SkiaSurface {
6464
) -> Self {
6565
let fb_info = {
6666
skia::gpu::gl::FramebufferInfo {
67-
fboid: fboid.try_into().unwrap(),
67+
fboid: fboid.into(),
6868
format: skia::gpu::gl::Format::RGBA8.into(),
6969
..Default::default()
7070
}
@@ -257,6 +257,7 @@ impl std::hash::Hash for EGLSurfaceWrapper {
257257
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
258258
pub enum SkiaTarget {
259259
// EGLSurface(smithay::backend::egl::ffi::egl::types::EGLSurface),
260+
#[allow(private_interfaces)]
260261
EGLSurface(EGLSurfaceWrapper),
261262
Texture(ffi::types::GLuint),
262263
Renderbuffer(*const GlesRenderbuffer),
@@ -280,7 +281,7 @@ impl std::fmt::Debug for SkiaRenderer {
280281
fn save_image(image: &skia::Image, name: &str) {
281282
use std::fs::File;
282283
use std::io::Write;
283-
284+
#[allow(deprecated)]
284285
let data = image.encode_to_data(skia::EncodedImageFormat::PNG).unwrap();
285286
let bytes = data.as_bytes();
286287
let filename = format!("{}.png", name);
@@ -627,7 +628,7 @@ impl Texture for SkiaTexture {
627628
}
628629
}
629630

630-
impl<'a> Frame for SkiaFrame {
631+
impl Frame for SkiaFrame {
631632
type Error = GlesError;
632633
type TextureId = SkiaTexture;
633634

@@ -703,7 +704,7 @@ impl<'a> Frame for SkiaFrame {
703704
src: Rectangle<f64, Buffer>,
704705
dst: Rectangle<i32, Physical>,
705706
damage: &[Rectangle<i32, Physical>],
706-
opaque_regions: &[Rectangle<i32, Physical>],
707+
_opaque_regions: &[Rectangle<i32, Physical>],
707708
src_transform: Transform,
708709
alpha: f32,
709710
) -> Result<(), Self::Error> {
@@ -805,7 +806,7 @@ impl<'a> Frame for SkiaFrame {
805806
};
806807

807808
// Transmute flushinfo2 into flushinfo
808-
let info = unsafe {
809+
let _info = unsafe {
809810
let native = &*(&info as *const FlushInfo2 as *const sb::GrFlushInfo);
810811
&*(native as *const sb::GrFlushInfo as *const skia_safe::gpu::FlushInfo)
811812
};
@@ -836,7 +837,8 @@ impl<'a> Frame for SkiaFrame {
836837
&mut self,
837838
sync: &smithay::backend::renderer::sync::SyncPoint,
838839
) -> Result<(), Self::Error> {
839-
sync.wait();
840+
sync.wait()
841+
.map_err(|_| GlesError::FramebufferBindingError)?;
840842
Ok(())
841843
}
842844
}
@@ -1212,7 +1214,7 @@ impl ImportDmaWl for SkiaRenderer {
12121214
) -> Result<<Self as Renderer>::TextureId, <Self as Renderer>::Error> {
12131215
let dmabuf = smithay::wayland::dmabuf::get_dmabuf(buffer)
12141216
.expect("import_dma_buffer without checking buffer type?");
1215-
self.import_dmabuf(&dmabuf, Some(damage))
1217+
self.import_dmabuf(dmabuf, Some(damage))
12161218
}
12171219
}
12181220

@@ -1448,6 +1450,7 @@ impl Bind<Dmabuf> for SkiaRenderer {
14481450
let target = SkiaTarget::Dmabuf(dmabuf.clone());
14491451
self.current_target = Some(target);
14501452
let egl_display = self.egl_context().display().clone();
1453+
#[allow(clippy::mutable_key_type)]
14511454
let buffers = self.buffers.borrow_mut();
14521455
buffers
14531456
.entry(SkiaTarget::Dmabuf(dmabuf.clone()))

src/state.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ impl<BackendData: Backend> SeatHandler for ScreenComposer<BackendData> {
325325
set_primary_focus(dh, seat, focus);
326326
}
327327

328-
fn cursor_image(&mut self, _seat: &Seat<Self>, image: CursorImageStatus) {
328+
fn cursor_image(&mut self, _seat: &Seat<Self>, _image: CursorImageStatus) {
329329
// println!("change icon {:?}", image);
330330
// *self.cursor_status.lock().unwrap() = image;
331331
}
@@ -992,13 +992,10 @@ impl<BackendData: Backend + 'static> ScreenComposer<BackendData> {
992992
) -> &WindowView {
993993
self.window_views
994994
.entry(object_id.clone())
995-
.or_insert_with(|| {
996-
let view = WindowView::new(self.layers_engine.clone(), parent_layer_id, window);
997-
view
998-
})
995+
.or_insert_with(|| WindowView::new(self.layers_engine.clone(), parent_layer_id, window))
999996
}
1000997
pub fn remove_window_view(&mut self, object_id: &ObjectId) {
1001-
if let Some(view) = self.window_views.remove(object_id) {}
998+
if let Some(_view) = self.window_views.remove(object_id) {}
1002999
}
10031000
pub fn get_window_view(&self, id: &ObjectId) -> Option<&WindowView> {
10041001
self.window_views.get(id)

src/udev.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use std::{
22
collections::hash_map::HashMap,
3-
convert::TryInto,
43
io,
54
path::Path,
65
sync::{atomic::Ordering, Mutex},
@@ -358,7 +357,7 @@ pub fn run_udev() {
358357
.iter_mut()
359358
.map(|(handle, backend)| (*handle, backend))
360359
{
361-
backend.drm.activate(false);
360+
let _ = backend.drm.activate(false);
362361
if let Some(lease_global) = backend.leasing_global.as_mut() {
363362
lease_global.resume::<ScreenComposer<UdevData>>();
364363
}
@@ -395,14 +394,14 @@ pub fn run_udev() {
395394
.shm_formats(),
396395
);
397396

398-
let skip_vulkan = std::env::var("ANVIL_NO_VULKAN")
399-
.map(|x| {
400-
x == "1"
401-
|| x.to_lowercase() == "true"
402-
|| x.to_lowercase() == "yes"
403-
|| x.to_lowercase() == "y"
404-
})
405-
.unwrap_or(false);
397+
// let skip_vulkan = std::env::var("ANVIL_NO_VULKAN")
398+
// .map(|x| {
399+
// x == "1"
400+
// || x.to_lowercase() == "true"
401+
// || x.to_lowercase() == "yes"
402+
// || x.to_lowercase() == "y"
403+
// })
404+
// .unwrap_or(false);
406405

407406
if state.backend_data.allocator.is_none() {
408407
info!("No vulkan allocator found, using GBM.");
@@ -1511,7 +1510,7 @@ impl ScreenComposer<UdevData> {
15111510
};
15121511
}
15131512

1514-
fn render_surface<'a, 'b>(&mut self, node: DrmNode, crtc: crtc::Handle) {
1513+
fn render_surface(&mut self, node: DrmNode, crtc: crtc::Handle) {
15151514
profiling::scope!("render_surface", &format!("{crtc:?}"));
15161515

15171516
let device = if let Some(device) = self.backend_data.backends.get_mut(&node) {
@@ -1544,7 +1543,7 @@ impl ScreenComposer<UdevData> {
15441543
let cursor_frame = self
15451544
.backend_data
15461545
.cursor_manager
1547-
.get_image(1, self.clock.now().try_into().unwrap());
1546+
.get_image(1, self.clock.now().into());
15481547

15491548
let pointer_images = &mut self.backend_data.pointer_images;
15501549
let pointer_image = pointer_images

src/utils/natural_layout.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ impl LayoutRect {
8686
}
8787
}
8888

89+
#[allow(clippy::mutable_key_type)]
8990
pub fn natural_layout(
9091
windows: &Vec<Window>,
9192
area: &LayoutRect,

src/winit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ pub fn run_winit() {
328328
let cursor_visible = !matches!(*cursor_guard, CursorImageStatus::Surface(_));
329329

330330
if let CursorImageStatus::Named(cursor) = *cursor_guard {
331-
backend.window().set_cursor_icon(cursor);
331+
backend.window().set_cursor(cursor);
332332
}
333333
pointer_element.set_status(cursor_guard.clone());
334334

src/workspace/app_switcher/view.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -162,20 +162,20 @@ impl AppSwitcherView {
162162
}
163163

164164
pub fn quit_current_app(&self) {
165-
if self.active.load(std::sync::atomic::Ordering::Relaxed) {
166-
let state = self.view.get_state();
167-
if let Some(app) = state.apps.get(state.current_app) {
168-
for window in app.windows.iter() {
169-
// match window.window_element.as_ref().unwrap() {
170-
// WindowElement::Wayland(w) => w.toplevel().send_close(),
171-
// #[cfg(feature = "xwayland")]
172-
// WindowElement::X11(w) => {
173-
// let _ = w.close();
174-
// }
175-
// }
176-
}
177-
}
178-
}
165+
// if self.active.load(std::sync::atomic::Ordering::Relaxed) {
166+
// let state = self.view.get_state();
167+
// if let Some(app) = state.apps.get(state.current_app) {
168+
// for window in app.windows.iter() {
169+
// match window.window_element.as_ref().unwrap() {
170+
// WindowElement::Wayland(w) => w.toplevel().send_close(),
171+
// #[cfg(feature = "xwayland")]
172+
// WindowElement::X11(w) => {
173+
// let _ = w.close();
174+
// }
175+
// }
176+
// }
177+
// }
178+
// }
179179
}
180180

181181
pub fn next_window(&self) {

0 commit comments

Comments
 (0)