Skip to content

Handle failure in Peripheral::Connect by returning an error (#353) #367

Handle failure in Peripheral::Connect by returning an error (#353)

Handle failure in Peripheral::Connect by returning an error (#353) #367

Triggered via push December 7, 2023 18:46
Status Success
Total duration 2m 57s
Artifacts

rust.yml

on: push
Matrix: build
Fit to window
Zoom out
Zoom in

Annotations

16 warnings
format
The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
build (ubuntu-latest)
The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2, actions-rs/clippy-check@v1. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
module `CentralDelegate` should have a snake case name: src/corebluetooth/central_delegate.rs#L296
warning: module `CentralDelegate` should have a snake case name --> src/corebluetooth/central_delegate.rs:296:9 | 296 | pub mod CentralDelegate { | ^^^^^^^^^^^^^^^ help: convert the identifier to snake case: `central_delegate` | = note: `#[warn(non_snake_case)]` on by default
usage of `contains_key` followed by `insert` on a `HashMap`: src/corebluetooth/internal.rs#L518
warning: usage of `contains_key` followed by `insert` on a `HashMap` --> src/corebluetooth/internal.rs:518:9 | 518 | / if self.peripherals.contains_key(&uuid) { 519 | | if let Some(name) = name { 520 | | self.dispatch_event(CoreBluetoothEvent::DeviceUpdated { uuid, name }) 521 | | .await; ... | 533 | | .await; 534 | | } | |_________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_entry = note: `#[warn(clippy::map_entry)]` on by default help: try | 518 ~ if let std::collections::hash_map::Entry::Vacant(e) = self.peripherals.entry(uuid) { 519 + // Create our channels 520 + let (event_sender, event_receiver) = mpsc::channel(256); 521 + e.insert(CBPeripheral::new(peripheral, event_sender)); 522 + self.dispatch_event(CoreBluetoothEvent::DeviceDiscovered { 523 + uuid, 524 + name, 525 + event_receiver, 526 + }) 527 + .await; 528 + } else { 529 + if let Some(name) = name { 530 + self.dispatch_event(CoreBluetoothEvent::DeviceUpdated { uuid, name }) 531 + .await; 532 + } 533 + } |
deref which would be done by auto-deref: src/corebluetooth/central_delegate.rs#L399
warning: deref which would be done by auto-deref --> src/corebluetooth/central_delegate.rs:399:17 | 399 | (*(*(&*delegate).get_ivar::<*mut c_void>(DELEGATE_SENDER_IVAR) | ^^^^^^^^^^^^ help: try: `delegate` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref = note: `#[warn(clippy::explicit_auto_deref)]` on by default
this expression borrows a value the compiler would automatically borrow: src/corebluetooth/central_delegate.rs#L399
warning: this expression borrows a value the compiler would automatically borrow --> src/corebluetooth/central_delegate.rs:399:17 | 399 | (*(*(&*delegate).get_ivar::<*mut c_void>(DELEGATE_SENDER_IVAR) | ^^^^^^^^^^^^ help: change this to: `(*delegate)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
use of `unwrap_or_else` to construct default value: src/corebluetooth/central_delegate.rs#L387
warning: use of `unwrap_or_else` to construct default value --> src/corebluetooth/central_delegate.rs:387:42 | 387 | nsstring_to_string(nsstring).unwrap_or_else(|| "".to_string()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default = note: `#[warn(clippy::unwrap_or_default)]` on by default
this expression borrows a value the compiler would automatically borrow: src/corebluetooth/central_delegate.rs#L319
warning: this expression borrows a value the compiler would automatically borrow --> src/corebluetooth/central_delegate.rs:319:36 | 319 | let _ = Box::from_raw(*(&*delegate).get_ivar::<*mut c_void>(DELEGATE_SENDER_IVAR) | ^^^^^^^^^^^^ help: change this to: `(*delegate)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow = note: `#[warn(clippy::needless_borrow)]` on by default
constant `PERIPHERALSTATE_CONNECTED` is never used: src/corebluetooth/framework.rs#L305
warning: constant `PERIPHERALSTATE_CONNECTED` is never used --> src/corebluetooth/framework.rs:305:15 | 305 | pub const PERIPHERALSTATE_CONNECTED: c_int = 2; // CBPeripheralStateConnected | ^^^^^^^^^^^^^^^^^^^^^^^^^
variants `Disonnected`, `Connecting`, `Connected`, and `Disconnecting` are never constructed: src/corebluetooth/framework.rs#L213
warning: variants `Disonnected`, `Connecting`, `Connected`, and `Disconnecting` are never constructed --> src/corebluetooth/framework.rs:213:9 | 212 | pub enum CBPeripheralState { | ----------------- variants in this enum 213 | Disonnected = 0, | ^^^^^^^^^^^ 214 | Connecting = 1, | ^^^^^^^^^^ 215 | Connected = 2, | ^^^^^^^^^ 216 | Disconnecting = 3, | ^^^^^^^^^^^^^ | = note: `CBPeripheralState` has derived impls for the traits `Debug` and `Clone`, but these are intentionally ignored during dead code analysis
variants `Restricted` and `Denied` are never constructed: src/corebluetooth/framework.rs#L193
warning: variants `Restricted` and `Denied` are never constructed --> src/corebluetooth/framework.rs:193:9 | 191 | pub enum CBManagerAuthorization { | ---------------------- variants in this enum 192 | NotDetermined = 0, 193 | Restricted = 1, | ^^^^^^^^^^ 194 | Denied = 2, | ^^^^^^ | = note: `CBManagerAuthorization` has derived impls for the traits `Debug` and `Clone`, but these are intentionally ignored during dead code analysis = note: `#[warn(dead_code)]` on by default
unused variable: `descriptor`: src/corebluetooth/internal.rs#L965
warning: unused variable: `descriptor` --> src/corebluetooth/internal.rs:965:33 | 965 | if let Some(descriptor) = characteristic.descriptors.get_mut(&descriptor_uuid) { | ^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_descriptor` | = note: `#[warn(unused_variables)]` on by default
redundant field names in struct initialization: src/corebluetooth/peripheral.rs#L169
warning: redundant field names in struct initialization --> src/corebluetooth/peripheral.rs:169:16 | 169 | Self { shared: shared } | ^^^^^^^^^^^^^^ help: replace it with: `shared` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names = note: `#[warn(clippy::redundant_field_names)]` on by default
unused import: `bleuuid::uuid_from_u16`: src/corebluetooth/internal.rs#L25
warning: unused import: `bleuuid::uuid_from_u16` --> src/corebluetooth/internal.rs:25:5 | 25 | bleuuid::uuid_from_u16, CharPropFlags, Characteristic, Descriptor, ScanFilter, Service, | ^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default
build (macOS-latest)
The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2, actions-rs/clippy-check@v1. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
build (windows-latest)
The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2, actions-rs/clippy-check@v1. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/