Skip to content

Commit 0568d60

Browse files
authored
Fix warnings and lints (#5)
1 parent 7e1f037 commit 0568d60

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ license = "MIT"
66
name = "usb_enumeration"
77
readme = "README.md"
88
repository = "https://github.com/meatysolutions/usb_enumeration"
9-
version = "0.1.2"
9+
version = "0.2.0"
1010

1111
[lib]
1212
crate-type = ["lib"]

src/lib.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ pub struct Subscription {
113113
pub rx_event: Receiver<Event>,
114114
// When this gets dropped, the channel will become disconnected and the
115115
// background thread will close
116-
tx_close: Sender<()>,
116+
_tx_close: Sender<()>,
117117
}
118118

119119
#[derive(Debug, Clone)]
@@ -197,7 +197,7 @@ impl Observer {
197197

198198
// Send Disconnect for missing devices
199199
for device in &device_list {
200-
if !next_devices.contains(&device)
200+
if !next_devices.contains(device)
201201
&& tx_event.send(Event::Disconnect(device.clone())).is_err()
202202
{
203203
return;
@@ -206,7 +206,7 @@ impl Observer {
206206

207207
// Send Connect for new devices
208208
for device in &next_devices {
209-
if !device_list.contains(&device)
209+
if !device_list.contains(device)
210210
&& tx_event.send(Event::Connect(device.clone())).is_err()
211211
{
212212
return;
@@ -219,7 +219,10 @@ impl Observer {
219219
})
220220
.expect("Could not spawn background thread");
221221

222-
Subscription { rx_event, tx_close }
222+
Subscription {
223+
rx_event,
224+
_tx_close: tx_close,
225+
}
223226
}
224227
}
225228

src/macos.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,16 @@ pub fn enumerate_platform(vid: Option<u16>, pid: Option<u16>) -> Vec<UsbDevice>
2626
#[allow(clippy::unit_cmp)]
2727
while (device = IOIteratorNext(iter)) == () && device > 0 {
2828
#[allow(clippy::uninit_assumed_init)]
29-
let mut props: CFMutableDictionaryRef = MaybeUninit::uninit().assume_init();
29+
let mut props = MaybeUninit::<CFMutableDictionaryRef>::uninit();
3030

31-
let _result =
32-
IORegistryEntryCreateCFProperties(device, &mut props, kCFAllocatorDefault, 0);
31+
let _result = IORegistryEntryCreateCFProperties(
32+
device,
33+
props.as_mut_ptr(),
34+
kCFAllocatorDefault,
35+
0,
36+
);
37+
38+
let props = props.assume_init();
3339

3440
let properties: CFDictionary<CFString, CFType> =
3541
CFMutableDictionary::wrap_under_get_rule(props).to_immutable();

0 commit comments

Comments
 (0)