*: Format code Run `cargo fmt` to format files Change-Id: If7515617a159ad2a3dbf16f49f577ea2f6d347c8 Reviewed-on: https://bluetooth-review.googlesource.com/c/bluetooth/+/2780 Reviewed-by: Ani Ramakrishnan <aniramakri@google.com> Reviewed-by: Rob Mohr <mohrr@google.com> Commit-Queue: Dayeong Lee <dayeonglee@google.com>
diff --git a/rust/bt-ascs/src/server.rs b/rust/bt-ascs/src/server.rs index 12b8274..1e8974b 100644 --- a/rust/bt-ascs/src/server.rs +++ b/rust/bt-ascs/src/server.rs
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -use bt_gatt::Characteristic; use bt_gatt::server::{ReadResponder, WriteResponder}; use bt_gatt::types::{ AttributePermissions, CharacteristicProperty, GattError, Handle, SecurityLevels, }; +use bt_gatt::Characteristic; use futures::task::{Poll, Waker}; -use futures::{Future, Stream, stream::FusedStream}; +use futures::{stream::FusedStream, Future, Stream}; use pin_project::pin_project; use std::collections::HashMap;
diff --git a/rust/bt-ascs/src/types.rs b/rust/bt-ascs/src/types.rs index 2fb54ad..fd6014d 100644 --- a/rust/bt-ascs/src/types.rs +++ b/rust/bt-ascs/src/types.rs
@@ -770,7 +770,7 @@ use bt_common::packet_encoding::Encodable; use bt_common::core::ltv::LtValue; - use bt_common::generic_audio::{AudioLocation, codec_configuration}; + use bt_common::generic_audio::{codec_configuration, AudioLocation}; #[test] fn codec_configuration_roundtrip() {
diff --git a/rust/bt-bap/src/types.rs b/rust/bt-bap/src/types.rs index a97a657..65bb251 100644 --- a/rust/bt-bap/src/types.rs +++ b/rust/bt-bap/src/types.rs
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -use bt_common::core::CodecId; use bt_common::core::ltv::LtValue; +use bt_common::core::CodecId; use bt_common::generic_audio::codec_configuration::CodecConfiguration; use bt_common::generic_audio::metadata_ltv::Metadata; use bt_common::packet_encoding::{Decodable, Encodable, Error as PacketError}; @@ -318,8 +318,8 @@ use std::collections::HashSet; - use bt_common::generic_audio::AudioLocation; use bt_common::generic_audio::codec_configuration::{FrameDuration, SamplingFrequency}; + use bt_common::generic_audio::AudioLocation; #[test] fn broadcast_id() {
diff --git a/rust/bt-bass/src/client/event.rs b/rust/bt-bass/src/client/event.rs index 0ff2768..bf4349e 100644 --- a/rust/bt-bass/src/client/event.rs +++ b/rust/bt-bass/src/client/event.rs
@@ -15,9 +15,9 @@ use bt_gatt::client::CharacteristicNotification; use bt_gatt::types::Error as BtGattError; -use crate::client::KnownBroadcastSources; use crate::client::error::Error; use crate::client::error::ServiceError; +use crate::client::KnownBroadcastSources; use crate::types::*; #[derive(Clone, Debug, PartialEq)]
diff --git a/rust/bt-battery/src/monitor/client.rs b/rust/bt-battery/src/monitor/client.rs index d1ae91e..0ac3ae3 100644 --- a/rust/bt-battery/src/monitor/client.rs +++ b/rust/bt-battery/src/monitor/client.rs
@@ -3,14 +3,14 @@ // found in the LICENSE file. use bt_common::packet_encoding::Decodable; -use bt_gatt::GattTypes; use bt_gatt::client::{CharacteristicNotification, PeerService, ServiceCharacteristic}; use bt_gatt::types::{CharacteristicProperty, Error as GattLibraryError, Handle}; +use bt_gatt::GattTypes; use futures::stream::{BoxStream, FusedStream, SelectAll, Stream, StreamExt}; use std::task::Poll; use crate::error::{Error, ServiceError}; -use crate::types::{BATTERY_LEVEL_UUID, BatteryLevel, READ_CHARACTERISTIC_BUFFER_SIZE}; +use crate::types::{BatteryLevel, BATTERY_LEVEL_UUID, READ_CHARACTERISTIC_BUFFER_SIZE}; /// Represents the termination status of a Stream. #[derive(Clone, Copy, Debug, PartialEq, Default)] @@ -199,13 +199,13 @@ pub(crate) mod tests { use super::*; - use bt_common::Uuid; use bt_common::packet_encoding::Error as PacketError; + use bt_common::Uuid; use bt_gatt::test_utils::{FakeClient, FakePeerService, FakeTypes}; use bt_gatt::types::{ AttributePermissions, Characteristic, CharacteristicProperties, GattError, }; - use futures::{FutureExt, pin_mut}; + use futures::{pin_mut, FutureExt}; pub(crate) const BATTERY_LEVEL_HANDLE: Handle = Handle(0x1); pub(crate) fn fake_battery_service(battery_level: u8) -> FakePeerService {
diff --git a/rust/bt-battery/src/types.rs b/rust/bt-battery/src/types.rs index ccc4428..9b51087 100644 --- a/rust/bt-battery/src/types.rs +++ b/rust/bt-battery/src/types.rs
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -use bt_common::Uuid; use bt_common::packet_encoding::{Decodable, Error as PacketError}; +use bt_common::Uuid; /// The UUID of the GATT battery service. /// Defined in Assigned Numbers Section 3.4.2.
diff --git a/rust/bt-common/src/generic_audio/metadata_ltv.rs b/rust/bt-common/src/generic_audio/metadata_ltv.rs index 75b4178..e23789a 100644 --- a/rust/bt-common/src/generic_audio/metadata_ltv.rs +++ b/rust/bt-common/src/generic_audio/metadata_ltv.rs
@@ -4,7 +4,7 @@ use crate::core::ltv::LtValue; use crate::packet_encoding::Error as PacketError; -use crate::{CompanyId, decodable_enum}; +use crate::{decodable_enum, CompanyId}; use crate::generic_audio::ContextType;
diff --git a/rust/bt-common/src/packet_encoding.rs b/rust/bt-common/src/packet_encoding.rs index 49f3e63..99845e3 100644 --- a/rust/bt-common/src/packet_encoding.rs +++ b/rust/bt-common/src/packet_encoding.rs
@@ -11,13 +11,14 @@ /// Decodes into a new object or an error, and the number of bytes that /// the decoding consumed. Should attempt to consume the entire item from - /// the buffer in the case of an error. If the item end cannot be determined, - /// return an error and consume the entirety of the bufer (`buf.len()`) + /// the buffer in the case of an error. If the item end cannot be + /// determined, return an error and consume the entirety of the bufer + /// (`buf.len()`) fn decode(buf: &[u8]) -> (::core::result::Result<Self, Self::Error>, usize); /// Tries to decode a collection of this object concatenated in a buffer. - /// Returns a vector of items (or errors) and the number of bytes consumed to - /// decode them. + /// Returns a vector of items (or errors) and the number of bytes consumed + /// to decode them. /// Continues to decode items until the buffer is consumed or the max items. /// If None, will decode the entire buffer. fn decode_multiple(
diff --git a/rust/bt-gatt/src/test_utils.rs b/rust/bt-gatt/src/test_utils.rs index 46aa379..d528b47 100644 --- a/rust/bt-gatt/src/test_utils.rs +++ b/rust/bt-gatt/src/test_utils.rs
@@ -3,9 +3,9 @@ // found in the LICENSE file. use bt_common::core::{Address, AddressType}; +use futures::channel::mpsc::{unbounded, UnboundedReceiver, UnboundedSender}; +use futures::future::{ready, Ready}; use futures::Stream; -use futures::channel::mpsc::{UnboundedReceiver, UnboundedSender, unbounded}; -use futures::future::{Ready, ready}; use parking_lot::Mutex; use std::collections::HashMap; use std::sync::Arc; @@ -18,7 +18,7 @@ use crate::periodic_advertising::{PeriodicAdvertising, SyncReport}; use crate::pii::GetPeerAddr; use crate::server::{self, LocalService, ReadResponder, ServiceDefinition, WriteResponder}; -use crate::{GattTypes, ServerTypes, types::*}; +use crate::{types::*, GattTypes, ServerTypes}; #[derive(Default)] struct FakePeerServiceInner {
diff --git a/rust/bt-pacs/src/lib.rs b/rust/bt-pacs/src/lib.rs index 412e574..fa05dc2 100644 --- a/rust/bt-pacs/src/lib.rs +++ b/rust/bt-pacs/src/lib.rs
@@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -use bt_common::Uuid; -use bt_common::core::CodecId; use bt_common::core::ltv::LtValue; +use bt_common::core::CodecId; use bt_common::generic_audio::codec_capabilities::CodecCapability; use bt_common::generic_audio::metadata_ltv::Metadata; use bt_common::generic_audio::{AudioLocation, ContextType}; use bt_common::packet_encoding::{Decodable, Encodable}; -use bt_gatt::{Characteristic, client::FromCharacteristic}; +use bt_common::Uuid; +use bt_gatt::{client::FromCharacteristic, Characteristic}; use std::collections::HashSet; @@ -467,12 +467,12 @@ use super::*; use bt_common::{ - Uuid, generic_audio::codec_capabilities::{CodecCapabilityType, SamplingFrequency}, + Uuid, }; use bt_gatt::{ - Characteristic, types::{AttributePermissions, Handle}, + Characteristic, }; use pretty_assertions::assert_eq;
diff --git a/rust/bt-pacs/src/server.rs b/rust/bt-pacs/src/server.rs index c279433..e2f185f 100644 --- a/rust/bt-pacs/src/server.rs +++ b/rust/bt-pacs/src/server.rs
@@ -30,10 +30,10 @@ //! } use bt_common::generic_audio::ContextType; -use bt_gatt::Server as _; use bt_gatt::server::LocalService; use bt_gatt::server::{ReadResponder, ServiceDefinition, WriteResponder}; use bt_gatt::types::{GattError, Handle}; +use bt_gatt::Server as _; use futures::task::{Poll, Waker}; use futures::{Future, Stream}; use pin_project::pin_project; @@ -396,10 +396,10 @@ mod tests { use super::*; - use bt_common::PeerId; use bt_common::core::{CodecId, CodingFormat}; - use bt_common::generic_audio::AudioLocation; use bt_common::generic_audio::codec_capabilities::*; + use bt_common::generic_audio::AudioLocation; + use bt_common::PeerId; use bt_gatt::server; use bt_gatt::test_utils::{FakeServer, FakeServerEvent, FakeTypes}; use bt_gatt::types::ServiceKind;
diff --git a/rust/bt-pacs/src/server/types.rs b/rust/bt-pacs/src/server/types.rs index a718502..70096af 100644 --- a/rust/bt-pacs/src/server/types.rs +++ b/rust/bt-pacs/src/server/types.rs
@@ -4,11 +4,11 @@ //! Define types and trait implementations specific to the PACS server. -use bt_gatt::Characteristic; use bt_gatt::client::FromCharacteristic; use bt_gatt::types::{ AttributePermissions, CharacteristicProperties, CharacteristicProperty, Handle, SecurityLevels, }; +use bt_gatt::Characteristic; use std::collections::HashSet;