fix remaining clippy lints

This commit is contained in:
Ferdinand Schober
2023-12-18 21:38:12 +01:00
parent 4600db7af8
commit 66de3e3cbc
4 changed files with 10 additions and 6 deletions

View File

@@ -140,7 +140,7 @@ impl EventConsumer for MacOSConsumer {
}
};
// store button state
self.button_state[mouse_button] = if state == 1 { true } else { false };
self.button_state[mouse_button] = state == 1;
let location = self.get_mouse_location().unwrap();
let event = match CGEvent::new_mouse_event(

View File

@@ -80,7 +80,7 @@ fn send_mouse_input(mi: MOUSEINPUT) {
};
SendInput(
1 as u32,
1_u32,
&mut input as LPINPUT,
std::mem::size_of::<INPUT>() as i32,
);
@@ -173,7 +173,7 @@ fn send_keyboard_input(ki: KEYBDINPUT) {
u: std::mem::zeroed(),
};
*input.u.ki_mut() = ki;
SendInput(1 as u32, &mut input, std::mem::size_of::<INPUT>() as i32);
SendInput(1_u32, &mut input, std::mem::size_of::<INPUT>() as i32);
}
}

View File

@@ -1,3 +1,4 @@
use anyhow::{anyhow, Result};
use crate::client::{ClientEvent, ClientHandle};
use crate::event::Event;
use crate::producer::EventProducer;
@@ -8,8 +9,8 @@ use std::{io, pin::Pin};
pub struct MacOSProducer;
impl MacOSProducer {
pub fn new() -> Self {
Self {}
pub fn new() -> Result<Self> {
Err(anyhow!("not yet implemented"))
}
}

View File

@@ -10,7 +10,10 @@ use crate::{
pub async fn create() -> Box<dyn EventProducer> {
#[cfg(target_os = "macos")]
return Box::new(producer::macos::MacOSProducer::new());
match producer::macos::MacOSProducer::new() {
Ok(p) => return Box::new(p),
Err(e) => log::info!("macos event producer not available: {e}"),
}
#[cfg(windows)]
match producer::windows::WindowsProducer::new() {