Skip to content

Commit

Permalink
Remove unused imports
Browse files Browse the repository at this point in the history
  • Loading branch information
a1ien committed Sep 16, 2020
1 parent acc74de commit 59d9ac6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 18 deletions.
12 changes: 5 additions & 7 deletions src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@ use libc::{c_int, c_void, timeval};

use std::{mem, ptr, sync::Arc, sync::Once, time::Duration};

use crate::{
device::{self, Device},
device_handle::{self, DeviceHandle},
device_list::DeviceList,
error,
};
use crate::{device::Device, device_handle::DeviceHandle, device_list::DeviceList, error};
use libusb1_sys::{constants::*, *};

#[cfg(windows)]
Expand Down Expand Up @@ -220,7 +215,10 @@ extern "system" fn hotplug_callback<T: UsbContext>(
) -> c_int {
unsafe {
let mut reg = Box::<CallbackData<T>>::from_raw(reg as _);
let device = device::Device::from_libusb(reg.context.clone(), std::ptr::NonNull::new_unchecked(device));
let device = Device::from_libusb(
reg.context.clone(),
std::ptr::NonNull::new_unchecked(device),
);
match event {
LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED => reg.hotplug.device_arrived(device),
LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT => reg.hotplug.device_left(device),
Expand Down
15 changes: 4 additions & 11 deletions src/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ use libusb1_sys::*;
use crate::{
config_descriptor::{self, ConfigDescriptor},
device_descriptor::{self, DeviceDescriptor},
device_handle::{self, DeviceHandle},
device_handle::DeviceHandle,
fields::{self, Speed},
UsbContext,
Error,
Error, UsbContext,
};

/// A reference to a USB device.
Expand Down Expand Up @@ -63,16 +62,10 @@ impl<T: UsbContext> Device<T> {
///
/// Converts an existing `libusb_device` pointer into a `Device<T>`.
/// `device` must be a pointer to a valid `libusb_device`. Rusb increments refcount.
pub unsafe fn from_libusb(
context: T,
device: NonNull<libusb_device>,
) -> Device<T> {
pub unsafe fn from_libusb(context: T, device: NonNull<libusb_device>) -> Device<T> {
libusb_ref_device(device.as_ptr());

Device {
context,
device,
}
Device { context, device }
}

/// Reads the device descriptor.
Expand Down

0 comments on commit 59d9ac6

Please sign in to comment.