From 5b8d4127e6c9c08553d0188bf812343ae06b19a1 Mon Sep 17 00:00:00 2001 From: Nicolas Patry Date: Mon, 25 Sep 2023 17:51:43 +0200 Subject: [PATCH] Fixing feature clippy. (#114) * Fixing feature clippy. * Remove duplicate CI. * Missing repr(C). * Make clippy happy on macos. --- .github/workflows/rust.yml | 7 ++++++- src/lib.rs | 4 ++-- src/macos/common.rs | 5 +++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index ec1b9947..07705b56 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,6 +1,11 @@ name: build -on: [push, pull_request] +on: + workflow_dispatch: + push: + branches: + - main + pull_request: jobs: build: diff --git a/src/lib.rs b/src/lib.rs index f405dbd1..64efbe40 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -330,7 +330,7 @@ pub use crate::macos::grab as _grab; #[cfg(feature = "unstable_grab")] #[cfg(target_os = "windows")] pub use crate::windows::grab as _grab; -#[cfg(any(feature = "unstable_grab"))] +#[cfg(feature = "unstable_grab")] /// Grabbing global events. In the callback, returning None ignores the event /// and returning the event let's it pass. There is no modification of the event /// possible here. @@ -356,7 +356,7 @@ pub use crate::windows::grab as _grab; /// } /// } /// ``` -#[cfg(any(feature = "unstable_grab"))] +#[cfg(feature = "unstable_grab")] pub fn grab(callback: T) -> Result<(), GrabError> where T: Fn(Event) -> Option + 'static, diff --git a/src/macos/common.rs b/src/macos/common.rs index 16c03710..6c837ab0 100644 --- a/src/macos/common.rs +++ b/src/macos/common.rs @@ -79,6 +79,11 @@ extern "C" { pub static kCFRunLoopCommonModes: CFRunLoopMode; } + +// TODO Remove this, this was added as the coded +// existed and worked, but clippy is complaining. +// There's probably a better fix. +#[allow(improper_ctypes_definitions)] pub type QCallback = unsafe extern "C" fn( proxy: CGEventTapProxy, _type: CGEventType,