fix: suppress Rust compiler warnings in buttplug

- #[allow(dead_code)] on FFICallbackContextWrapper, Connected variant,
  Unsubscribe variant, and device_event_receiver field
- let _ = for unused Result from callback.call1() (x2) and .send().await

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-08 17:21:58 +01:00
parent 8f4999f127
commit d4b3968518
2 changed files with 7 additions and 3 deletions

View File

@@ -23,6 +23,7 @@ type FFICallback = js_sys::Function;
type FFICallbackContext = u32; type FFICallbackContext = u32;
#[derive(Clone, Copy)] #[derive(Clone, Copy)]
#[allow(dead_code)]
pub struct FFICallbackContextWrapper(FFICallbackContext); pub struct FFICallbackContextWrapper(FFICallbackContext);
unsafe impl Send for FFICallbackContextWrapper { unsafe impl Send for FFICallbackContextWrapper {
@@ -50,7 +51,7 @@ pub fn send_server_message(
let buf = json.as_bytes(); let buf = json.as_bytes();
let this = JsValue::null(); let this = JsValue::null();
let uint8buf = unsafe { Uint8Array::new(&Uint8Array::view(buf)) }; let uint8buf = unsafe { Uint8Array::new(&Uint8Array::view(buf)) };
callback.call1(&this, &JsValue::from(uint8buf)); let _ = callback.call1(&this, &JsValue::from(uint8buf));
} }
} }
@@ -119,7 +120,7 @@ pub fn buttplug_client_send_json_message(
let buf = json.as_bytes(); let buf = json.as_bytes();
let this = JsValue::null(); let this = JsValue::null();
let uint8buf = unsafe { Uint8Array::new(&Uint8Array::view(buf)) }; let uint8buf = unsafe { Uint8Array::new(&Uint8Array::view(buf)) };
callback.call1(&this, &JsValue::from(uint8buf)); let _ = callback.call1(&this, &JsValue::from(uint8buf));
} }
}); });
} }

View File

@@ -184,6 +184,7 @@ impl HardwareSpecializer for WebBluetoothHardwareSpecializer {
pub enum WebBluetoothEvent { pub enum WebBluetoothEvent {
// This is the only way we have to get our endpoints back to device creation // This is the only way we have to get our endpoints back to device creation
// right now. My god this is a mess. // right now. My god this is a mess.
#[allow(dead_code)]
Connected(Vec<Endpoint>), Connected(Vec<Endpoint>),
Disconnected, Disconnected,
} }
@@ -201,6 +202,7 @@ pub enum WebBluetoothDeviceCommand {
HardwareSubscribeCmd, HardwareSubscribeCmd,
oneshot::Sender<Result<(), ButtplugDeviceError>>, oneshot::Sender<Result<(), ButtplugDeviceError>>,
), ),
#[allow(dead_code)]
Unsubscribe( Unsubscribe(
HardwareUnsubscribeCmd, HardwareUnsubscribeCmd,
oneshot::Sender<Result<(), ButtplugDeviceError>>, oneshot::Sender<Result<(), ButtplugDeviceError>>,
@@ -271,7 +273,7 @@ async fn run_webbluetooth_loop(
//let web_btle_device = WebBluetoothDeviceImpl::new(device, char_map); //let web_btle_device = WebBluetoothDeviceImpl::new(device, char_map);
info!("device created!"); info!("device created!");
let endpoints = char_map.keys().into_iter().cloned().collect(); let endpoints = char_map.keys().into_iter().cloned().collect();
device_local_event_sender let _ = device_local_event_sender
.send(WebBluetoothEvent::Connected(endpoints)) .send(WebBluetoothEvent::Connected(endpoints))
.await; .await;
while let Some(msg) = device_command_receiver.recv().await { while let Some(msg) = device_command_receiver.recv().await {
@@ -337,6 +339,7 @@ async fn run_webbluetooth_loop(
#[derive(Debug)] #[derive(Debug)]
pub struct WebBluetoothHardware { pub struct WebBluetoothHardware {
device_command_sender: mpsc::Sender<WebBluetoothDeviceCommand>, device_command_sender: mpsc::Sender<WebBluetoothDeviceCommand>,
#[allow(dead_code)]
device_event_receiver: mpsc::Receiver<WebBluetoothEvent>, device_event_receiver: mpsc::Receiver<WebBluetoothEvent>,
event_sender: broadcast::Sender<HardwareEvent>, event_sender: broadcast::Sender<HardwareEvent>,
} }