mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-04-17 10:01:29 +03:00
clippy
This commit is contained in:
@@ -33,7 +33,7 @@ pub mod dummy;
|
|||||||
pub async fn create_backend(
|
pub async fn create_backend(
|
||||||
backend: CaptureBackend,
|
backend: CaptureBackend,
|
||||||
) -> Result<Box<dyn InputCapture<Item = io::Result<(ClientHandle, Event)>>>, CaptureCreationError> {
|
) -> Result<Box<dyn InputCapture<Item = io::Result<(ClientHandle, Event)>>>, CaptureCreationError> {
|
||||||
return match backend {
|
match backend {
|
||||||
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
|
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
|
||||||
CaptureBackend::InputCapturePortal => Ok(Box::new(libei::LibeiInputCapture::new().await?)),
|
CaptureBackend::InputCapturePortal => Ok(Box::new(libei::LibeiInputCapture::new().await?)),
|
||||||
#[cfg(all(unix, feature = "wayland", not(target_os = "macos")))]
|
#[cfg(all(unix, feature = "wayland", not(target_os = "macos")))]
|
||||||
@@ -45,7 +45,7 @@ pub async fn create_backend(
|
|||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
CaptureBackend::MacOs => Ok(Box::new(macos::MacOSInputCapture::new()?)),
|
CaptureBackend::MacOs => Ok(Box::new(macos::MacOSInputCapture::new()?)),
|
||||||
CaptureBackend::Dummy => Ok(Box::new(dummy::DummyInputCapture::new())),
|
CaptureBackend::Dummy => Ok(Box::new(dummy::DummyInputCapture::new())),
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn create(
|
pub async fn create(
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ impl Display for CaptureCreationError {
|
|||||||
CaptureCreationError::Macos(e) => format!("{e}"),
|
CaptureCreationError::Macos(e) => format!("{e}"),
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
CaptureCreationError::Windows => format!(""),
|
CaptureCreationError::Windows => format!(""),
|
||||||
CaptureCreationError::NoAvailableBackend => format!("no available backend"),
|
CaptureCreationError::NoAvailableBackend => "no available backend".to_string(),
|
||||||
};
|
};
|
||||||
write!(f, "could not create input capture: {reason}")
|
write!(f, "could not create input capture: {reason}")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ pub trait InputEmulation: Send {
|
|||||||
pub async fn create_backend(
|
pub async fn create_backend(
|
||||||
backend: EmulationBackend,
|
backend: EmulationBackend,
|
||||||
) -> Result<Box<dyn InputEmulation>, EmulationCreationError> {
|
) -> Result<Box<dyn InputEmulation>, EmulationCreationError> {
|
||||||
return match backend {
|
match backend {
|
||||||
#[cfg(all(unix, feature = "wayland", not(target_os = "macos")))]
|
#[cfg(all(unix, feature = "wayland", not(target_os = "macos")))]
|
||||||
EmulationBackend::Wlroots => Ok(Box::new(wlroots::WlrootsEmulation::new()?)),
|
EmulationBackend::Wlroots => Ok(Box::new(wlroots::WlrootsEmulation::new()?)),
|
||||||
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
|
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
|
||||||
@@ -64,7 +64,7 @@ pub async fn create_backend(
|
|||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
EmulationBackend::MacOs => Ok(Box::new(macos::MacOSEmulation::new()?)),
|
EmulationBackend::MacOs => Ok(Box::new(macos::MacOSEmulation::new()?)),
|
||||||
EmulationBackend::Dummy => Ok(Box::new(dummy::DummyEmulation::new())),
|
EmulationBackend::Dummy => Ok(Box::new(dummy::DummyEmulation::new())),
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn create(
|
pub async fn create(
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ impl Display for EmulationCreationError {
|
|||||||
EmulationCreationError::X11(e) => format!("x11 backend: {e}"),
|
EmulationCreationError::X11(e) => format!("x11 backend: {e}"),
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
EmulationCreationError::MacOs(e) => format!("macos backend: {e}"),
|
EmulationCreationError::MacOs(e) => format!("macos backend: {e}"),
|
||||||
EmulationCreationError::NoAvailableBackend => format!("no backend available"),
|
EmulationCreationError::NoAvailableBackend => "no backend available".to_string(),
|
||||||
};
|
};
|
||||||
write!(f, "could not create input emulation backend: {reason}")
|
write!(f, "could not create input emulation backend: {reason}")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user