diff --git a/clippy.toml b/clippy.toml index 018bc337..d2db8030 100644 --- a/clippy.toml +++ b/clippy.toml @@ -1,16 +1,17 @@ +# Using allow-invalid because this is platform-specific code disallowed-methods = [ - { path = "objc2_app_kit::NSView::visibleRect", reason = "We expose a render target to the user, and visibility is not really relevant to that (and can break if you don't use the rectangle position as well). Use `frame` instead." }, - { path = "objc2_app_kit::NSWindow::setFrameTopLeftPoint", reason = "Not sufficient when working with Winit's coordinate system, use `flip_window_screen_coordinates` instead" }, - { path = "web_sys::Document::exit_fullscreen", reason = "Doesn't account for compatibility with Safari" }, - { path = "web_sys::Document::fullscreen_element", reason = "Doesn't account for compatibility with Safari" }, - { path = "web_sys::Element::request_fullscreen", reason = "Doesn't account for compatibility with Safari" }, - { path = "web_sys::HtmlCanvasElement::height", reason = "Winit shouldn't touch the internal canvas size" }, - { path = "web_sys::HtmlCanvasElement::set_height", reason = "Winit shouldn't touch the internal canvas size" }, - { path = "web_sys::HtmlCanvasElement::set_width", reason = "Winit shouldn't touch the internal canvas size" }, - { path = "web_sys::HtmlCanvasElement::width", reason = "Winit shouldn't touch the internal canvas size" }, - { path = "web_sys::HtmlElement::style", reason = "cache this to reduce calls to JS" }, - { path = "web_sys::Window::document", reason = "cache this to reduce calls to JS" }, - { path = "web_sys::Window::get_computed_style", reason = "cache this to reduce calls to JS" }, - { path = "web_sys::Window::navigator", reason = "cache this to reduce calls to JS" }, - { path = "web_sys::window", reason = "is not available in every context" }, + { allow-invalid = true, path = "objc2_app_kit::NSView::visibleRect", reason = "We expose a render target to the user, and visibility is not really relevant to that (and can break if you don't use the rectangle position as well). Use `frame` instead." }, + { allow-invalid = true, path = "objc2_app_kit::NSWindow::setFrameTopLeftPoint", reason = "Not sufficient when working with Winit's coordinate system, use `flip_window_screen_coordinates` instead" }, + { allow-invalid = true, path = "web_sys::Document::exit_fullscreen", reason = "Doesn't account for compatibility with Safari" }, + { allow-invalid = true, path = "web_sys::Document::fullscreen_element", reason = "Doesn't account for compatibility with Safari" }, + { allow-invalid = true, path = "web_sys::Element::request_fullscreen", reason = "Doesn't account for compatibility with Safari" }, + { allow-invalid = true, path = "web_sys::HtmlCanvasElement::height", reason = "Winit shouldn't touch the internal canvas size" }, + { allow-invalid = true, path = "web_sys::HtmlCanvasElement::set_height", reason = "Winit shouldn't touch the internal canvas size" }, + { allow-invalid = true, path = "web_sys::HtmlCanvasElement::set_width", reason = "Winit shouldn't touch the internal canvas size" }, + { allow-invalid = true, path = "web_sys::HtmlCanvasElement::width", reason = "Winit shouldn't touch the internal canvas size" }, + { allow-invalid = true, path = "web_sys::HtmlElement::style", reason = "cache this to reduce calls to JS" }, + { allow-invalid = true, path = "web_sys::Window::document", reason = "cache this to reduce calls to JS" }, + { allow-invalid = true, path = "web_sys::Window::get_computed_style", reason = "cache this to reduce calls to JS" }, + { allow-invalid = true, path = "web_sys::Window::navigator", reason = "cache this to reduce calls to JS" }, + { allow-invalid = true, path = "web_sys::window", reason = "is not available in every context" }, ] diff --git a/examples/dnd.rs b/examples/dnd.rs index 51d1ee45..8b21743b 100644 --- a/examples/dnd.rs +++ b/examples/dnd.rs @@ -49,7 +49,7 @@ impl ApplicationHandler for Application { | WindowEvent::DragEntered { .. } | WindowEvent::DragMoved { .. } | WindowEvent::DragDropped { .. } => { - println!("{:?}", event); + println!("{event:?}"); }, WindowEvent::RedrawRequested => { let window = self.window.as_ref().unwrap(); diff --git a/src/platform_impl/linux/mod.rs b/src/platform_impl/linux/mod.rs index d8239572..d1d959b3 100644 --- a/src/platform_impl/linux/mod.rs +++ b/src/platform_impl/linux/mod.rs @@ -119,6 +119,7 @@ macro_rules! x11_or_wayland { } #[derive(Debug)] +#[allow(clippy::large_enum_variant)] pub enum EventLoop { #[cfg(wayland_platform)] Wayland(Box), diff --git a/src/platform_impl/linux/x11/util/randr.rs b/src/platform_impl/linux/x11/util/randr.rs index ab1fc57a..8f0b4475 100644 --- a/src/platform_impl/linux/x11/util/randr.rs +++ b/src/platform_impl/linux/x11/util/randr.rs @@ -82,7 +82,7 @@ impl XConnection { .iter() // XRROutputInfo contains an array of mode ids that correspond to // modes in the array in XRRScreenResources - .filter(|x| output_modes.iter().any(|id| x.id == *id)) + .filter(|x| output_modes.contains(&x.id)) .map(|mode| VideoModeHandle { current: mode.id == current_mode, mode: VideoMode::new( diff --git a/src/platform_impl/linux/x11/window.rs b/src/platform_impl/linux/x11/window.rs index af2422c4..013c366b 100644 --- a/src/platform_impl/linux/x11/window.rs +++ b/src/platform_impl/linux/x11/window.rs @@ -1307,8 +1307,8 @@ impl UnownedWindow { let vert_atom = atoms[_NET_WM_STATE_MAXIMIZED_VERT]; match state { Ok(atoms) => { - let horz_maximized = atoms.iter().any(|atom: &xproto::Atom| *atom == horz_atom); - let vert_maximized = atoms.iter().any(|atom: &xproto::Atom| *atom == vert_atom); + let horz_maximized = atoms.contains(&horz_atom); + let vert_maximized = atoms.contains(&vert_atom); horz_maximized && vert_maximized }, _ => false,