fix: corebluetooth peripheral name #507
Annotations
37 warnings
|
hiding a lifetime that's elided elsewhere is confusing:
src/common/adapter_manager.rs#L79
warning: hiding a lifetime that's elided elsewhere is confusing
--> src/common/adapter_manager.rs:79:9
|
79 | &self,
| ^^^^^ the lifetime is elided here
80 | id: &PeripheralId,
81 | ) -> Option<RefMut<PeripheralId, PeripheralType>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the same lifetime is hidden here
|
= help: the same lifetime is referred to in inconsistent ways, making the signature confusing
= note: `#[warn(mismatched_lifetime_syntaxes)]` on by default
help: use `'_` for type paths
|
81 | ) -> Option<RefMut<'_, PeripheralId, PeripheralType>> {
| +++
|
|
usage of `contains_key` followed by `insert` on a `HashMap`:
src/corebluetooth/internal.rs#L582
warning: usage of `contains_key` followed by `insert` on a `HashMap`
--> src/corebluetooth/internal.rs:582:9
|
582 | / if self.peripherals.contains_key(&uuid) {
583 | | if local_name.is_some() {
584 | | self.dispatch_event(CoreBluetoothEvent::DeviceUpdated {
585 | | uuid,
... |
602 | | .await;
603 | | }
| |_________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#map_entry
help: try
|
582 ~ if let std::collections::hash_map::Entry::Vacant(e) = self.peripherals.entry(uuid) {
583 + // Create our channels
584 + let (event_sender, event_receiver) = mpsc::channel(256);
585 + e.insert(PeripheralInternal::new(peripheral, event_sender));
586 + self.dispatch_event(CoreBluetoothEvent::DeviceDiscovered {
587 + uuid,
588 + local_name,
589 + advertisement_name,
590 + event_receiver,
591 + })
592 + .await;
593 + } else {
594 + if local_name.is_some() {
595 + self.dispatch_event(CoreBluetoothEvent::DeviceUpdated {
596 + uuid,
597 + local_name,
598 + advertisement_name,
599 + })
600 + .await;
601 + }
602 + }
|
|
|
explicit call to `.into_iter()` in function argument accepting `IntoIterator`:
src/corebluetooth/internal.rs#L355
warning: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
--> src/corebluetooth/internal.rs:355:32
|
355 | .chain(unsubscribe_future_state.into_iter());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
--> /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library/core/src/iter/traits/iterator.rs:498:12
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#useless_conversion
help: consider removing the `.into_iter()`
|
355 - .chain(unsubscribe_future_state.into_iter());
355 + .chain(&*unsubscribe_future_state);
|
|
|
this `.into_iter()` call is equivalent to `.iter()` and will not consume the `VecDeque`:
src/corebluetooth/internal.rs#L355
warning: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `VecDeque`
--> src/corebluetooth/internal.rs:355:57
|
355 | .chain(unsubscribe_future_state.into_iter());
| ^^^^^^^^^ help: call directly: `iter`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#into_iter_on_ref
|
|
explicit call to `.into_iter()` in function argument accepting `IntoIterator`:
src/corebluetooth/internal.rs#L354
warning: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
--> src/corebluetooth/internal.rs:354:32
|
354 | .chain(subscribe_future_state.into_iter())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
--> /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library/core/src/iter/traits/iterator.rs:498:12
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#useless_conversion
help: consider removing the `.into_iter()`
|
354 - .chain(subscribe_future_state.into_iter())
354 + .chain(&*subscribe_future_state)
|
|
|
this `.into_iter()` call is equivalent to `.iter()` and will not consume the `VecDeque`:
src/corebluetooth/internal.rs#L354
warning: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `VecDeque`
--> src/corebluetooth/internal.rs:354:55
|
354 | .chain(subscribe_future_state.into_iter())
| ^^^^^^^^^ help: call directly: `iter`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#into_iter_on_ref
|
|
explicit call to `.into_iter()` in function argument accepting `IntoIterator`:
src/corebluetooth/internal.rs#L353
warning: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
--> src/corebluetooth/internal.rs:353:32
|
353 | .chain(write_future_state.into_iter())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
--> /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library/core/src/iter/traits/iterator.rs:498:12
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#useless_conversion
= note: `#[warn(clippy::useless_conversion)]` on by default
help: consider removing the `.into_iter()`
|
353 - .chain(write_future_state.into_iter())
353 + .chain(&*write_future_state)
|
|
|
this `.into_iter()` call is equivalent to `.iter()` and will not consume the `VecDeque`:
src/corebluetooth/internal.rs#L353
warning: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `VecDeque`
--> src/corebluetooth/internal.rs:353:51
|
353 | .chain(write_future_state.into_iter())
| ^^^^^^^^^ help: call directly: `iter`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#into_iter_on_ref
|
|
this `.into_iter()` call is equivalent to `.iter()` and will not consume the `VecDeque`:
src/corebluetooth/internal.rs#L352
warning: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `VecDeque`
--> src/corebluetooth/internal.rs:352:26
|
352 | .into_iter()
| ^^^^^^^^^ help: call directly: `iter`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#into_iter_on_ref
= note: `#[warn(clippy::into_iter_on_ref)]` on by default
|
|
usage of `contains_key` followed by `insert` on a `HashMap`:
src/corebluetooth/internal.rs#L225
warning: usage of `contains_key` followed by `insert` on a `HashMap`
--> src/corebluetooth/internal.rs:225:17
|
225 | / if !map.contains_key(&characteristic_uuid) {
226 | | map.insert(
227 | | characteristic_uuid,
228 | | CharacteristicInternal::new(characteristic),
229 | | );
230 | | }
| |_________________^ help: try: `map.entry(characteristic_uuid).or_insert_with(|| CharacteristicInternal::new(characteristic));`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#map_entry
= note: `#[warn(clippy::map_entry)]` on by default
|
|
deref which would be done by auto-deref:
src/corebluetooth/internal.rs#L92
warning: deref which would be done by auto-deref
--> src/corebluetooth/internal.rs:92:61
|
92 | let properties = CharacteristicInternal::form_flags(&*characteristic);
| ^^^^^^^^^^^^^^^^ help: try: `&characteristic`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#explicit_auto_deref
= note: `#[warn(clippy::explicit_auto_deref)]` on by default
|
|
doc list item without indentation:
src/corebluetooth/future.rs#L39
warning: doc list item without indentation
--> src/corebluetooth/future.rs:39:9
|
39 | /// corresponding future.
| ^
|
= help: if this is supposed to be its own paragraph, add a blank line
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#doc_lazy_continuation
= note: `#[warn(clippy::doc_lazy_continuation)]` on by default
help: indent this line
|
39 | /// corresponding future.
| ++
|
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/corebluetooth/central_delegate.rs#L695
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/corebluetooth/central_delegate.rs:695:48
|
695 | data: get_descriptor_value(&descriptor),
| ^^^^^^^^^^^ help: change this to: `descriptor`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#needless_borrow
= note: `#[warn(clippy::needless_borrow)]` on by default
|
|
redundant field names in struct initialization:
src/corebluetooth/peripheral.rs#L177
warning: redundant field names in struct initialization
--> src/corebluetooth/peripheral.rs:177:16
|
177 | Self { shared: shared }
| ^^^^^^^^^^^^^^ help: replace it with: `shared`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#redundant_field_names
= note: `#[warn(clippy::redundant_field_names)]` on by default
|
|
unnecessary parentheses around closure body:
src/corebluetooth/central_delegate.rs#L390
warning: unnecessary parentheses around closure body
--> src/corebluetooth/central_delegate.rs:390:29
|
390 | .map(|name| (name as *const AnyObject as *const NSString))
| ^ ^
|
= note: `#[warn(unused_parens)]` (part of `#[warn(unused)]`) on by default
help: remove these parentheses
|
390 - .map(|name| (name as *const AnyObject as *const NSString))
390 + .map(|name| name as *const AnyObject as *const NSString)
|
|
|
iterating on a map's values:
src/bluez/peripheral.rs#L377
warning: iterating on a map's values
--> src/bluez/peripheral.rs:377:22
|
377 | descriptors: descriptors
| ______________________^
378 | | .iter()
379 | | .map(|(_, descriptor)| make_descriptor(descriptor, info.uuid, service_uuid))
| |________________________________________________________________________________________^ help: try: `descriptors.values().map(|descriptor| make_descriptor(descriptor, info.uuid, service_uuid))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#iter_kv_map
= note: `#[warn(clippy::iter_kv_map)]` on by default
|
|
usage of `contains_key` followed by `insert` on a `HashMap`:
src/bluez/peripheral.rs#L194
warning: usage of `contains_key` followed by `insert` on a `HashMap`
--> src/bluez/peripheral.rs:194:29
|
194 | / ... if !map.contains_key(&characteristic.uuid) {
195 | | ... map.insert(characteristic.uuid, characteristic);
196 | | ... }
| |_______________________^ help: try: `map.entry(characteristic.uuid).or_insert(characteristic);`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#map_entry
= note: `#[warn(clippy::map_entry)]` on by default
|
|
this `match` can be collapsed into the outer `match`:
src/bluez/adapter.rs#L182
warning: this `match` can be collapsed into the outer `match`
--> src/bluez/adapter.rs:182:34
|
182 | } if id == adapter_id => match adapter_event {
| __________________________________^
183 | | AdapterEvent::Powered { powered } => {
184 | | let state = get_central_state(powered);
185 | | Some(CentralEvent::StateUpdate(state))
186 | | }
187 | | _ => None,
188 | | },
| |_________^
|
help: the outer pattern can be modified to include the inner pattern
--> src/bluez/adapter.rs:181:20
|
181 | event: adapter_event,
| ^^^^^^^^^^^^^ replace this binding
182 | } if id == adapter_id => match adapter_event {
183 | AdapterEvent::Powered { powered } => {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ with this pattern, prefixed by `adapter_event: `
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#collapsible_match
= note: `#[warn(clippy::collapsible_match)]` on by default
|
|
hiding a lifetime that's elided elsewhere is confusing:
src/droidplug/jni/objects.rs#L427
warning: hiding a lifetime that's elided elsewhere is confusing
--> src/droidplug/jni/objects.rs:427:28
|
427 | pub fn get_descriptors(&self) -> Result<Vec<JBluetoothGattDescriptor>> {
| ^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^
| | |
| | the same lifetime is hidden here
| | the same lifetime is hidden here
| the lifetime is elided here
|
= help: the same lifetime is referred to in inconsistent ways, making the signature confusing
help: use `'_` for type paths
|
427 | pub fn get_descriptors(&self) -> Result<Vec<JBluetoothGattDescriptor<'_>>> {
| ++++
|
|
hiding a lifetime that's elided elsewhere is confusing:
src/droidplug/jni/objects.rs#L340
warning: hiding a lifetime that's elided elsewhere is confusing
--> src/droidplug/jni/objects.rs:340:32
|
340 | pub fn get_characteristics(&self) -> Result<Vec<JBluetoothGattCharacteristic>> {
| ^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| | |
| | the same lifetime is hidden here
| | the same lifetime is hidden here
| the lifetime is elided here
|
= help: the same lifetime is referred to in inconsistent ways, making the signature confusing
help: use `'_` for type paths
|
340 | pub fn get_characteristics(&self) -> Result<Vec<JBluetoothGattCharacteristic<'_>>> {
| ++++
|
|
hiding a lifetime that's elided elsewhere is confusing:
src/common/adapter_manager.rs#L79
warning: hiding a lifetime that's elided elsewhere is confusing
--> src/common/adapter_manager.rs:79:9
|
79 | &self,
| ^^^^^ the lifetime is elided here
80 | id: &PeripheralId,
81 | ) -> Option<RefMut<PeripheralId, PeripheralType>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the same lifetime is hidden here
|
= help: the same lifetime is referred to in inconsistent ways, making the signature confusing
= note: `#[warn(mismatched_lifetime_syntaxes)]` on by default
help: use `'_` for type paths
|
81 | ) -> Option<RefMut<'_, PeripheralId, PeripheralType>> {
| +++
|
|
redundant closure:
src/droidplug/mod.rs#L14
warning: redundant closure
--> src/droidplug/mod.rs:14:36
|
14 | GLOBAL_ADAPTER.get_or_try_init(|| adapter::Adapter::new())?;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the associated function itself: `adapter::Adapter::new`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#redundant_closure
= note: `#[warn(clippy::redundant_closure)]` on by default
|
|
using `clone` on type `JObject<'_>` which implements the `Copy` trait:
src/droidplug/jni/objects.rs#L722
warning: using `clone` on type `JObject<'_>` which implements the `Copy` trait
--> src/droidplug/jni/objects.rs:722:33
|
722 | .is_same_object(services_obj.clone(), JObject::null())?
| ^^^^^^^^^^^^^^^^^^^^ help: try dereferencing it: `*services_obj`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#clone_on_copy
|
|
using `clone` on type `JObject<'_>` which implements the `Copy` trait:
src/droidplug/jni/objects.rs#L705
warning: using `clone` on type `JObject<'_>` which implements the `Copy` trait
--> src/droidplug/jni/objects.rs:705:33
|
705 | .is_same_object(service_data_obj.clone(), JObject::null())?
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try dereferencing it: `*service_data_obj`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#clone_on_copy
|
|
using `clone` on type `JObject<'_>` which implements the `Copy` trait:
src/droidplug/jni/objects.rs#L689
warning: using `clone` on type `JObject<'_>` which implements the `Copy` trait
--> src/droidplug/jni/objects.rs:689:33
|
689 | .is_same_object(manufacturer_specific_data_obj.clone(), JObject::null())?
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try dereferencing it: `*manufacturer_specific_data_obj`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#clone_on_copy
|
|
using `clone` on type `JObject<'_>` which implements the `Copy` trait:
src/droidplug/jni/objects.rs#L649
warning: using `clone` on type `JObject<'_>` which implements the `Copy` trait
--> src/droidplug/jni/objects.rs:649:29
|
649 | .is_same_object(record_obj.clone(), JObject::null())?
| ^^^^^^^^^^^^^^^^^^ help: try dereferencing it: `*record_obj`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#clone_on_copy
= note: `#[warn(clippy::clone_on_copy)]` on by default
|
|
enclosing `Ok` and `?` operator are unneeded:
src/droidplug/jni/objects.rs#L475
warning: enclosing `Ok` and `?` operator are unneeded
--> src/droidplug/jni/objects.rs:475:9
|
475 | Ok(uuid_obj.as_uuid()?)
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#needless_question_mark
help: remove the enclosing `Ok` and `?` operator
|
475 - Ok(uuid_obj.as_uuid()?)
475 + uuid_obj.as_uuid()
|
|
|
enclosing `Ok` and `?` operator are unneeded:
src/droidplug/jni/objects.rs#L398
warning: enclosing `Ok` and `?` operator are unneeded
--> src/droidplug/jni/objects.rs:398:9
|
398 | Ok(uuid_obj.as_uuid()?)
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#needless_question_mark
help: remove the enclosing `Ok` and `?` operator
|
398 - Ok(uuid_obj.as_uuid()?)
398 + uuid_obj.as_uuid()
|
|
|
enclosing `Ok` and `?` operator are unneeded:
src/droidplug/jni/objects.rs#L337
warning: enclosing `Ok` and `?` operator are unneeded
--> src/droidplug/jni/objects.rs:337:9
|
337 | Ok(uuid_obj.as_uuid()?)
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#needless_question_mark
= note: `#[warn(clippy::needless_question_mark)]` on by default
help: remove the enclosing `Ok` and `?` operator
|
337 - Ok(uuid_obj.as_uuid()?)
337 + uuid_obj.as_uuid()
|
|
|
this expression borrows a value the compiler would automatically borrow:
src/droidplug/peripheral.rs#L257
warning: this expression borrows a value the compiler would automatically borrow
--> src/droidplug/peripheral.rs:257:9
|
257 | (&guard.services).clone()
| ^^^^^^^^^^^^^^^^^ help: change this to: `guard.services`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#needless_borrow
|
|
this expression borrows a value the compiler would automatically borrow:
src/droidplug/peripheral.rs#L228
warning: this expression borrows a value the compiler would automatically borrow
--> src/droidplug/peripheral.rs:228:9
|
228 | (&guard.characteristics).clone()
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `guard.characteristics`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#needless_borrow
|
|
this expression borrows a value the compiler would automatically borrow:
src/droidplug/peripheral.rs#L223
warning: this expression borrows a value the compiler would automatically borrow
--> src/droidplug/peripheral.rs:223:12
|
223 | Ok((&guard.properties).clone())
| ^^^^^^^^^^^^^^^^^^^ help: change this to: `guard.properties`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#needless_borrow
= note: `#[warn(clippy::needless_borrow)]` on by default
|
|
function `notifications_stream_from_broadcast_receiver` is never used:
src/common/util.rs#L14
warning: function `notifications_stream_from_broadcast_receiver` is never used
--> src/common/util.rs:14:8
|
14 | pub fn notifications_stream_from_broadcast_receiver(
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default
|
|
build (android)
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
|
|
build (android)
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
|
|
build (android)
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
|
|
build (android)
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
|