diff options
author | Dennis Kempin <denniskempin@google.com> | 2022-07-27 18:11:32 +0000 |
---|---|---|
committer | crosvm LUCI <crosvm-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-07-28 00:15:50 +0000 |
commit | 4fea399df99dd7b8f6eeaf02ca375181b48d3ca2 (patch) | |
tree | a5974e5a8ed3209768bbf91684a262d6a9202980 /usb_util | |
parent | 18d435aa17186dd30385d231cc855d06d30d520e (diff) | |
download | crosvm-4fea399df99dd7b8f6eeaf02ca375181b48d3ca2.tar.gz |
Reformat imports
crosvm is switching the import style to use one import per line.
While more verbose, this will greatly reduce the occurence of merge
conflicts going forward.
Note: This is using a nightly feature of rustfmt. So it's a one-off
re-format only. We are considering adding a nightly toolchain to
enable the feature permanently.
BUG=b:239937122
TEST=CQ
Change-Id: Id2dd4dbdc0adfc4f8f3dd1d09da1daafa2a39992
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3784345
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Diffstat (limited to 'usb_util')
-rw-r--r-- | usb_util/src/descriptor.rs | 14 | ||||
-rw-r--r-- | usb_util/src/device.rs | 37 | ||||
-rw-r--r-- | usb_util/src/error.rs | 5 | ||||
-rw-r--r-- | usb_util/src/lib.rs | 35 | ||||
-rw-r--r-- | usb_util/src/types.rs | 4 |
5 files changed, 66 insertions, 29 deletions
diff --git a/usb_util/src/descriptor.rs b/usb_util/src/descriptor.rs index adf48d83a..7784b2715 100644 --- a/usb_util/src/descriptor.rs +++ b/usb_util/src/descriptor.rs @@ -2,14 +2,20 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -use crate::types::{self, Descriptor, DescriptorHeader, EndpointDescriptor}; -use crate::{Error, Result}; -use base::warn; -use data_model::DataInit; use std::collections::BTreeMap; use std::mem::size_of; use std::ops::Deref; +use base::warn; +use data_model::DataInit; + +use crate::types::Descriptor; +use crate::types::DescriptorHeader; +use crate::types::EndpointDescriptor; +use crate::types::{self}; +use crate::Error; +use crate::Result; + #[derive(Clone)] pub struct DeviceDescriptorTree { // Full descriptor tree in the original format returned by the device. diff --git a/usb_util/src/device.rs b/usb_util/src/device.rs index d07d3ccd9..381bc095a 100644 --- a/usb_util/src/device.rs +++ b/usb_util/src/device.rs @@ -2,21 +2,38 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -use crate::{ - control_request_type, descriptor, ConfigDescriptorTree, - ControlRequestDataPhaseTransferDirection, ControlRequestRecipient, ControlRequestType, - DeviceDescriptor, DeviceDescriptorTree, Error, Result, StandardControlRequest, -}; -use base::{handle_eintr_errno, AsRawDescriptor, IoctlNr, RawDescriptor}; -use data_model::vec_with_array_field; -use libc::{EAGAIN, ENODEV, ENOENT}; use std::convert::TryInto; use std::fs::File; -use std::io::{Read, Seek, SeekFrom}; +use std::io::Read; +use std::io::Seek; +use std::io::SeekFrom; use std::mem::size_of_val; -use std::os::raw::{c_int, c_uint, c_void}; +use std::os::raw::c_int; +use std::os::raw::c_uint; +use std::os::raw::c_void; use std::sync::Arc; +use base::handle_eintr_errno; +use base::AsRawDescriptor; +use base::IoctlNr; +use base::RawDescriptor; +use data_model::vec_with_array_field; +use libc::EAGAIN; +use libc::ENODEV; +use libc::ENOENT; + +use crate::control_request_type; +use crate::descriptor; +use crate::ConfigDescriptorTree; +use crate::ControlRequestDataPhaseTransferDirection; +use crate::ControlRequestRecipient; +use crate::ControlRequestType; +use crate::DeviceDescriptor; +use crate::DeviceDescriptorTree; +use crate::Error; +use crate::Result; +use crate::StandardControlRequest; + /// Device represents a USB device. pub struct Device { fd: Arc<File>, diff --git a/usb_util/src/error.rs b/usb_util/src/error.rs index b24fccd36..5aa5192f7 100644 --- a/usb_util/src/error.rs +++ b/usb_util/src/error.rs @@ -2,10 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -use base::IoctlNr; -use remain::sorted; use std::io; use std::num; + +use base::IoctlNr; +use remain::sorted; use thiserror::Error; #[sorted] diff --git a/usb_util/src/lib.rs b/usb_util/src/lib.rs index 21342c96f..9d27bc230 100644 --- a/usb_util/src/lib.rs +++ b/usb_util/src/lib.rs @@ -9,14 +9,27 @@ mod device; mod error; mod types; -pub use self::descriptor::{ - parse_usbfs_descriptors, ConfigDescriptorTree, DeviceDescriptorTree, InterfaceDescriptorTree, -}; -pub use self::device::{Device, Transfer, TransferStatus}; -pub use self::error::{Error, Result}; -pub use self::types::{ - control_request_type, ConfigDescriptor, ControlRequestDataPhaseTransferDirection, - ControlRequestRecipient, ControlRequestType, DescriptorHeader, DescriptorType, - DeviceDescriptor, EndpointDescriptor, EndpointDirection, EndpointType, InterfaceDescriptor, - StandardControlRequest, UsbRequestSetup, ENDPOINT_DIRECTION_OFFSET, -}; +pub use self::descriptor::parse_usbfs_descriptors; +pub use self::descriptor::ConfigDescriptorTree; +pub use self::descriptor::DeviceDescriptorTree; +pub use self::descriptor::InterfaceDescriptorTree; +pub use self::device::Device; +pub use self::device::Transfer; +pub use self::device::TransferStatus; +pub use self::error::Error; +pub use self::error::Result; +pub use self::types::control_request_type; +pub use self::types::ConfigDescriptor; +pub use self::types::ControlRequestDataPhaseTransferDirection; +pub use self::types::ControlRequestRecipient; +pub use self::types::ControlRequestType; +pub use self::types::DescriptorHeader; +pub use self::types::DescriptorType; +pub use self::types::DeviceDescriptor; +pub use self::types::EndpointDescriptor; +pub use self::types::EndpointDirection; +pub use self::types::EndpointType; +pub use self::types::InterfaceDescriptor; +pub use self::types::StandardControlRequest; +pub use self::types::UsbRequestSetup; +pub use self::types::ENDPOINT_DIRECTION_OFFSET; diff --git a/usb_util/src/types.rs b/usb_util/src/types.rs index 7eb94ca2b..316f8316a 100644 --- a/usb_util/src/types.rs +++ b/usb_util/src/types.rs @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +use std::mem::size_of; + use assertions::const_assert; use data_model::DataInit; -use std::mem::size_of; - /// Standard USB descriptor types. pub enum DescriptorType { Device = 0x01, |