Skip to content

Commit 87b026b

Browse files
pastaqShadowApex
authored andcommitted
fix(build): Fix build warnings and make test build errors
1 parent 42c53a4 commit 87b026b

File tree

11 files changed

+26
-24
lines changed

11 files changed

+26
-24
lines changed

src/dbus/interface/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,4 +252,4 @@ pub trait Unregisterable {
252252
}
253253
}
254254

255-
type UnregisterFn = (dyn std::ops::Fn(Connection, String) + 'static + Send + Sync);
255+
type UnregisterFn = dyn std::ops::Fn(Connection, String) + 'static + Send + Sync;

src/dbus/interface/target/touchscreen.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ use zbus_macros::interface;
55
/// The [TargetTouchscreenInterface] provides a DBus interface that can be exposed for managing
66
/// a [TouchscreenDevice]. It works by sending command messages to a channel that the
77
/// [TouchscreenDevice] is listening on.
8+
#[allow(dead_code)]
89
pub struct TargetTouchscreenInterface {}
910

1011
impl TargetTouchscreenInterface {
12+
#[allow(dead_code)]
1113
pub fn new() -> TargetTouchscreenInterface {
1214
TargetTouchscreenInterface {}
1315
}
@@ -23,6 +25,7 @@ impl Default for TargetTouchscreenInterface {
2325
impl TargetTouchscreenInterface {
2426
/// Name of the target device
2527
#[zbus(property)]
28+
#[allow(dead_code)]
2629
async fn name(
2730
&self,
2831
#[zbus(connection)] conn: &Connection,

src/drivers/unified_gamepad/reports.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ impl From<u8> for ReportType {
6060

6161
/// Feature report types
6262
#[derive(PrimitiveEnum_u8, Clone, Copy, PartialEq, Debug)]
63+
#[allow(dead_code)]
6364
pub enum FeatureReportType {
6465
/// Instruct the driver to return a feature report with the available capabilities
6566
GetInputCapabilities = 0x01,

src/input/composite_device/client.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const DEFAULT_TIMEOUT: Duration = Duration::from_secs(5);
2424
#[derive(Error, Debug)]
2525
pub enum ClientError {
2626
#[error("failed to send command to device: {0}")]
27-
SendError(SendError<CompositeCommand>),
27+
SendError(String),
2828
#[error("service encountered an error processing the request: {0}")]
2929
ServiceError(Box<dyn std::error::Error>),
3030
#[error("device no longer exists")]
@@ -33,7 +33,7 @@ pub enum ClientError {
3333

3434
impl From<SendError<CompositeCommand>> for ClientError {
3535
fn from(err: SendError<CompositeCommand>) -> Self {
36-
Self::SendError(err)
36+
Self::SendError(err.to_string())
3737
}
3838
}
3939

src/input/composite_device/mod.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -730,10 +730,7 @@ impl CompositeDevice {
730730

731731
// Only send valid events to the target device(s)
732732
if cap == Capability::NotImplemented {
733-
log::trace!(
734-
"Refusing to send '{}' event to target devices.",
735-
cap.to_string()
736-
);
733+
log::trace!("Refusing to send '{cap}' event to target devices.");
737734
return Ok(());
738735
}
739736

src/input/event/evdev.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -936,13 +936,15 @@ fn input_event_from_value(
936936
// the minimum and maximum values for that axis depending on the
937937
// axis direction. This is typically done for DPad button input that
938938
// needs to be translated to an ABS_HAT axis input.
939-
if axis_info.is_some() && axis_direction.is_some() {
940-
let info = axis_info.unwrap();
941-
let direction = axis_direction.unwrap();
942-
match direction {
943-
AxisDirection::None => Some(value),
944-
AxisDirection::Positive => Some(info.maximum() * value),
945-
AxisDirection::Negative => Some(info.minimum() * value),
939+
if let Some(info) = axis_info {
940+
if let Some(direction) = axis_direction {
941+
match direction {
942+
AxisDirection::None => Some(value),
943+
AxisDirection::Positive => Some(info.maximum() * value),
944+
AxisDirection::Negative => Some(info.minimum() * value),
945+
}
946+
} else {
947+
Some(value)
946948
}
947949
} else {
948950
Some(value)
@@ -971,8 +973,8 @@ fn input_event_from_value(
971973
// Cannot denormalize value without axis info
972974
EventType::ABSOLUTE => None,
973975
EventType::RELATIVE => match RelativeAxisCode(code) {
974-
RelativeAxisCode::REL_X => Some(x? as i32),
975-
RelativeAxisCode::REL_Y => Some(y? as i32),
976+
RelativeAxisCode::REL_X => x.map(|v| v as i32),
977+
RelativeAxisCode::REL_Y => y.map(|v| v as i32),
976978
_ => None,
977979
},
978980
_ => None,

src/input/manager.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ impl Manager {
299299
let path = device.keys().next().cloned();
300300
let response = match path {
301301
Some(path) => Ok(path),
302-
None => Err(ManagerError::CreateTargetDeviceFailed(
302+
_ => Err(ManagerError::CreateTargetDeviceFailed(
303303
"Unable to find device path".to_string(),
304304
)),
305305
};
@@ -860,7 +860,7 @@ impl Manager {
860860
let tx = self.tx.clone();
861861
let task = tokio::spawn(async move {
862862
if let Err(e) = device.run().await {
863-
log::error!("Error running {composite_path}: {}", e.to_string());
863+
log::error!("Error running {composite_path}: {e}");
864864
}
865865
log::debug!("Composite device stopped running: {composite_path}");
866866
if let Err(e) = tx
@@ -870,8 +870,7 @@ impl Manager {
870870
.await
871871
{
872872
log::error!(
873-
"Error sending to composite device {composite_path} the stopped signal: {}",
874-
e.to_string()
873+
"Error sending to composite device {composite_path} the stopped signal: {e}"
875874
);
876875
}
877876
});

src/input/source/evdev.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub enum EventDevice {
4444
}
4545

4646
impl SourceDeviceCompatible for EventDevice {
47-
fn get_device_ref(&self) -> DeviceInfoRef {
47+
fn get_device_ref(&self) -> DeviceInfoRef<'_> {
4848
match self {
4949
EventDevice::Blocked(source_driver) => source_driver.info_ref(),
5050
EventDevice::Gamepad(source_driver) => source_driver.info_ref(),

src/input/source/hidraw.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ pub enum HidRawDevice {
8585
}
8686

8787
impl SourceDeviceCompatible for HidRawDevice {
88-
fn get_device_ref(&self) -> DeviceInfoRef {
88+
fn get_device_ref(&self) -> DeviceInfoRef<'_> {
8989
match self {
9090
HidRawDevice::Blocked(source_driver) => source_driver.info_ref(),
9191
HidRawDevice::DualSense(source_driver) => source_driver.info_ref(),

src/input/source/iio.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub enum IioDevice {
3434
}
3535

3636
impl SourceDeviceCompatible for IioDevice {
37-
fn get_device_ref(&self) -> DeviceInfoRef {
37+
fn get_device_ref(&self) -> DeviceInfoRef<'_> {
3838
match self {
3939
IioDevice::BmiImu(source_driver) => source_driver.info_ref(),
4040
IioDevice::AccelGryo3D(source_driver) => source_driver.info_ref(),

0 commit comments

Comments
 (0)