aboutsummaryrefslogtreecommitdiffstats
path: root/components/bluetooth
diff options
context:
space:
mode:
Diffstat (limited to 'components/bluetooth')
-rw-r--r--components/bluetooth/lib.rs9
-rw-r--r--components/bluetooth/test.rs34
2 files changed, 18 insertions, 25 deletions
diff --git a/components/bluetooth/lib.rs b/components/bluetooth/lib.rs
index 8d9f7bd0af5..e563c8fd8a4 100644
--- a/components/bluetooth/lib.rs
+++ b/components/bluetooth/lib.rs
@@ -4,15 +4,8 @@
#[macro_use]
extern crate bitflags;
-extern crate bluetooth_traits;
-extern crate device;
-extern crate embedder_traits;
-extern crate ipc_channel;
#[macro_use]
extern crate log;
-extern crate servo_config;
-extern crate servo_rand;
-extern crate uuid;
pub mod test;
@@ -29,7 +22,7 @@ use embedder_traits::{EmbedderMsg, EmbedderProxy};
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use servo_config::opts;
use servo_config::prefs::PREFS;
-use servo_rand::Rng;
+use servo_rand::{self, Rng};
use std::borrow::ToOwned;
use std::collections::{HashMap, HashSet};
use std::string::String;
diff --git a/components/bluetooth/test.rs b/components/bluetooth/test.rs
index 6138bbdb35e..0056f06767c 100644
--- a/components/bluetooth/test.rs
+++ b/components/bluetooth/test.rs
@@ -137,7 +137,7 @@ fn generate_id() -> Uuid {
}
// Set the adapter's name, is_powered and is_discoverable attributes
-fn set_adapter(adapter: &BluetoothAdapter, adapter_name: String) -> Result<(), Box<Error>> {
+fn set_adapter(adapter: &BluetoothAdapter, adapter_name: String) -> Result<(), Box<dyn Error>> {
adapter.set_name(adapter_name)?;
adapter.set_powered(true)?;
adapter.set_discoverable(true)?;
@@ -149,7 +149,7 @@ fn create_device(
adapter: &BluetoothAdapter,
name: String,
address: String,
-) -> Result<BluetoothDevice, Box<Error>> {
+) -> Result<BluetoothDevice, Box<dyn Error>> {
let device = BluetoothDevice::create_mock_device(adapter.clone(), generate_id().to_string())?;
device.set_name(Some(name))?;
device.set_address(address)?;
@@ -163,7 +163,7 @@ fn create_device_with_uuids(
name: String,
address: String,
uuids: Vec<String>,
-) -> Result<BluetoothDevice, Box<Error>> {
+) -> Result<BluetoothDevice, Box<dyn Error>> {
let device = create_device(adapter, name, address)?;
device.set_uuids(uuids)?;
Ok(device)
@@ -173,7 +173,7 @@ fn create_device_with_uuids(
fn create_service(
device: &BluetoothDevice,
uuid: String,
-) -> Result<BluetoothGATTService, Box<Error>> {
+) -> Result<BluetoothGATTService, Box<dyn Error>> {
let service =
BluetoothGATTService::create_mock_service(device.clone(), generate_id().to_string())?;
service.set_uuid(uuid)?;
@@ -184,7 +184,7 @@ fn create_service(
fn create_characteristic(
service: &BluetoothGATTService,
uuid: String,
-) -> Result<BluetoothGATTCharacteristic, Box<Error>> {
+) -> Result<BluetoothGATTCharacteristic, Box<dyn Error>> {
let characteristic = BluetoothGATTCharacteristic::create_mock_characteristic(
service.clone(),
generate_id().to_string(),
@@ -198,7 +198,7 @@ fn create_characteristic_with_value(
service: &BluetoothGATTService,
uuid: String,
value: Vec<u8>,
-) -> Result<BluetoothGATTCharacteristic, Box<Error>> {
+) -> Result<BluetoothGATTCharacteristic, Box<dyn Error>> {
let characteristic = create_characteristic(service, uuid)?;
characteristic.set_value(value)?;
Ok(characteristic)
@@ -208,7 +208,7 @@ fn create_characteristic_with_value(
fn create_descriptor(
characteristic: &BluetoothGATTCharacteristic,
uuid: String,
-) -> Result<BluetoothGATTDescriptor, Box<Error>> {
+) -> Result<BluetoothGATTDescriptor, Box<dyn Error>> {
let descriptor = BluetoothGATTDescriptor::create_mock_descriptor(
characteristic.clone(),
generate_id().to_string(),
@@ -222,7 +222,7 @@ fn create_descriptor_with_value(
characteristic: &BluetoothGATTCharacteristic,
uuid: String,
value: Vec<u8>,
-) -> Result<BluetoothGATTDescriptor, Box<Error>> {
+) -> Result<BluetoothGATTDescriptor, Box<dyn Error>> {
let descriptor = create_descriptor(characteristic, uuid)?;
descriptor.set_value(value)?;
Ok(descriptor)
@@ -231,7 +231,7 @@ fn create_descriptor_with_value(
fn create_heart_rate_service(
device: &BluetoothDevice,
empty: bool,
-) -> Result<BluetoothGATTService, Box<Error>> {
+) -> Result<BluetoothGATTService, Box<dyn Error>> {
// Heart Rate Service
let heart_rate_service = create_service(device, HEART_RATE_SERVICE_UUID.to_owned())?;
@@ -274,7 +274,7 @@ fn create_heart_rate_service(
fn create_generic_access_service(
device: &BluetoothDevice,
empty: bool,
-) -> Result<BluetoothGATTService, Box<Error>> {
+) -> Result<BluetoothGATTService, Box<dyn Error>> {
// Generic Access Service
let generic_access_service = create_service(device, GENERIC_ACCESS_SERVICE_UUID.to_owned())?;
@@ -335,7 +335,7 @@ fn create_generic_access_service(
fn create_heart_rate_device(
adapter: &BluetoothAdapter,
empty: bool,
-) -> Result<BluetoothDevice, Box<Error>> {
+) -> Result<BluetoothDevice, Box<dyn Error>> {
// Heart Rate Device
let heart_rate_device = create_device_with_uuids(
adapter,
@@ -362,7 +362,7 @@ fn create_heart_rate_device(
fn create_missing_characterisitc_heart_rate_device(
adapter: &BluetoothAdapter,
-) -> Result<(), Box<Error>> {
+) -> Result<(), Box<dyn Error>> {
let heart_rate_device_empty = create_heart_rate_device(adapter, true)?;
let _generic_access_service_empty =
@@ -375,7 +375,7 @@ fn create_missing_characterisitc_heart_rate_device(
fn create_missing_descriptor_heart_rate_device(
adapter: &BluetoothAdapter,
-) -> Result<(), Box<Error>> {
+) -> Result<(), Box<dyn Error>> {
let heart_rate_device_empty = create_heart_rate_device(adapter, true)?;
let generic_access_service_empty =
@@ -399,7 +399,7 @@ fn create_missing_descriptor_heart_rate_device(
Ok(())
}
-fn create_two_heart_rate_services_device(adapter: &BluetoothAdapter) -> Result<(), Box<Error>> {
+fn create_two_heart_rate_services_device(adapter: &BluetoothAdapter) -> Result<(), Box<dyn Error>> {
let heart_rate_device_empty = create_heart_rate_device(adapter, true)?;
heart_rate_device_empty.set_uuids(vec![
@@ -435,7 +435,7 @@ fn create_two_heart_rate_services_device(adapter: &BluetoothAdapter) -> Result<(
Ok(())
}
-fn create_blocklisted_device(adapter: &BluetoothAdapter) -> Result<(), Box<Error>> {
+fn create_blocklisted_device(adapter: &BluetoothAdapter) -> Result<(), Box<dyn Error>> {
let connectable_device = create_device_with_uuids(
adapter,
CONNECTABLE_DEVICE_NAME.to_owned(),
@@ -490,7 +490,7 @@ fn create_blocklisted_device(adapter: &BluetoothAdapter) -> Result<(), Box<Error
Ok(())
}
-fn create_glucose_heart_rate_devices(adapter: &BluetoothAdapter) -> Result<(), Box<Error>> {
+fn create_glucose_heart_rate_devices(adapter: &BluetoothAdapter) -> Result<(), Box<dyn Error>> {
let glucose_devie = create_device_with_uuids(
adapter,
GLUCOSE_DEVICE_NAME.to_owned(),
@@ -517,7 +517,7 @@ fn create_glucose_heart_rate_devices(adapter: &BluetoothAdapter) -> Result<(), B
Ok(())
}
-pub fn test(manager: &mut BluetoothManager, data_set_name: String) -> Result<(), Box<Error>> {
+pub fn test(manager: &mut BluetoothManager, data_set_name: String) -> Result<(), Box<dyn Error>> {
let may_existing_adapter = manager.get_or_create_adapter();
let adapter = match may_existing_adapter.as_ref() {
Some(adapter) => adapter,