diff --git a/CHANGELOG.md b/CHANGELOG.md index 718c940bc..38b9fd091 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -862,6 +862,7 @@ By @jimblandy in [#3254](https://github.com/gfx-rs/wgpu/pull/3254). - Move `ResourceMetadata` into its own module. By @jimblandy in [#3213](https://github.com/gfx-rs/wgpu/pull/3213) - Add WebAssembly testing infrastructure. By @haraldreingruber in [#3238](https://github.com/gfx-rs/wgpu/pull/3238) - Error message when you forget to use cargo-nextest. By @cwfitzgerald in [#3293](https://github.com/gfx-rs/wgpu/pull/3293) +- Fix all suggestions from `cargo clippy` ## wgpu-0.14.2 (2022-11-28) diff --git a/wgpu-core/src/id.rs b/wgpu-core/src/id.rs index 6aa2aa287..3ed5c5581 100644 --- a/wgpu-core/src/id.rs +++ b/wgpu-core/src/id.rs @@ -122,7 +122,7 @@ impl Copy for Id {} impl Clone for Id { fn clone(&self) -> Self { - Self(self.0, PhantomData) + *self } } diff --git a/wgpu-hal/src/gles/egl.rs b/wgpu-hal/src/gles/egl.rs index 7e2f33083..5d153cc78 100644 --- a/wgpu-hal/src/gles/egl.rs +++ b/wgpu-hal/src/gles/egl.rs @@ -1,7 +1,7 @@ use glow::HasContext; use parking_lot::{Mutex, MutexGuard}; -use std::{ffi, os::raw, ptr, sync::Arc, time::Duration}; +use std::{ffi, os::raw, ptr, rc::Rc, sync::Arc, time::Duration}; /// The amount of time to wait while trying to obtain a lock to the adapter context const CONTEXT_LOCK_TIMEOUT_SECS: u64 = 1; @@ -683,7 +683,7 @@ enum WindowKind { #[derive(Clone, Debug)] struct WindowSystemInterface { - display_owner: Option>, + display_owner: Option>, kind: WindowKind, } @@ -798,7 +798,7 @@ impl crate::Instance for Instance { ) } .unwrap(); - (display, Some(Arc::new(library)), WindowKind::Wayland) + (display, Some(Rc::new(library)), WindowKind::Wayland) } else if let (Some(display_owner), Some(egl)) = (x11_display_library, egl1_5) { log::info!("Using X11 platform"); let display_attributes = [khronos_egl::ATTRIB_NONE]; @@ -810,7 +810,7 @@ impl crate::Instance for Instance { ) } .unwrap(); - (display, Some(Arc::new(display_owner)), WindowKind::X11) + (display, Some(Rc::new(display_owner)), WindowKind::X11) } else if let (Some(display_owner), Some(egl)) = (angle_x11_display_library, egl1_5) { log::info!("Using Angle platform with X11"); let display_attributes = [ @@ -828,7 +828,7 @@ impl crate::Instance for Instance { ) } .unwrap(); - (display, Some(Arc::new(display_owner)), WindowKind::AngleX11) + (display, Some(Rc::new(display_owner)), WindowKind::AngleX11) } else if client_ext_str.contains("EGL_MESA_platform_surfaceless") { log::info!("No windowing system present. Using surfaceless platform"); let egl = egl1_5.expect("Failed to get EGL 1.5 for surfaceless"); @@ -840,6 +840,7 @@ impl crate::Instance for Instance { ) } .unwrap(); + (display, None, WindowKind::Unknown) } else { log::info!("EGL_MESA_platform_surfaceless not available. Using default platform"); @@ -1209,8 +1210,7 @@ impl crate::Surface for Surface { let library = &self.wsi.display_owner.as_ref().unwrap().library; let wl_egl_window_create: libloading::Symbol = unsafe { library.get(b"wl_egl_window_create") }.unwrap(); - let window = unsafe { wl_egl_window_create(handle.surface, 640, 480) } - as *mut _ as *mut std::ffi::c_void; + let window = unsafe { wl_egl_window_create(handle.surface, 640, 480) }; wl_window = Some(window); window }