Skip to content

Commit

Permalink
fix remaining clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
feschber committed Dec 18, 2023
1 parent 4600db7 commit 66de3e3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/backend/consumer/macos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions src/backend/consumer/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
Expand Down Expand Up @@ -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);
}
}

Expand Down
5 changes: 3 additions & 2 deletions src/backend/producer/macos.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use anyhow::{anyhow, Result};
use crate::client::{ClientEvent, ClientHandle};
use crate::event::Event;
use crate::producer::EventProducer;
Expand All @@ -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"))
}
}

Expand Down
5 changes: 4 additions & 1 deletion src/producer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 66de3e3

Please sign in to comment.