Allow SimpleClient to yield in case of garbage responses #230
clippy
239 warnings
Details
Results
Message level | Amount |
---|---|
Internal compiler error | 0 |
Error | 0 |
Warning | 239 |
Note | 0 |
Help | 0 |
Versions
- rustc 1.84.1 (e71f9a9a9 2025-01-27)
- cargo 1.84.1 (66221abde 2024-11-19)
- clippy 0.1.84 (e71f9a9a98 2025-01-27)
Annotations
Check warning on line 6 in examples/src/common/general/mod.rs
github-actions / clippy
usage of wildcard import
warning: usage of wildcard import
--> examples/src/common/general/mod.rs:6:5
|
6 | use responses::*;
| ^^^^^^^^^^^^ help: try: `responses::{ManufacturerId, ModelId, SoftwareVersion, WifiMac}`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wildcard_imports
= note: `-W clippy::wildcard-imports` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::wildcard_imports)]`
Check warning on line 1 in examples/src/lib.rs
github-actions / clippy
multiple versions for dependency `nb`: 0.1.3, 1.1.0
warning: multiple versions for dependency `nb`: 0.1.3, 1.1.0
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_crate_versions
Check warning on line 1 in examples/src/lib.rs
github-actions / clippy
multiple versions for dependency `heapless-bytes`: 0.3.0, 0.4.0
warning: multiple versions for dependency `heapless-bytes`: 0.3.0, 0.4.0
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_crate_versions
Check warning on line 1 in examples/src/lib.rs
github-actions / clippy
multiple versions for dependency `heapless`: 0.7.17, 0.8.0
warning: multiple versions for dependency `heapless`: 0.7.17, 0.8.0
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_crate_versions
Check warning on line 1 in examples/src/lib.rs
github-actions / clippy
multiple versions for dependency `hash32`: 0.2.1, 0.3.1
warning: multiple versions for dependency `hash32`: 0.2.1, 0.3.1
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_crate_versions
Check warning on line 1 in examples/src/lib.rs
github-actions / clippy
multiple versions for dependency `embedded-hal`: 0.2.7, 1.0.0
warning: multiple versions for dependency `embedded-hal`: 0.2.7, 1.0.0
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_crate_versions
= note: `-W clippy::multiple-crate-versions` implied by `-W clippy::cargo`
= help: to override `-W clippy::cargo` add `#[allow(clippy::multiple_crate_versions)]`
Check warning on line 61 in atat_derive/src/urc.rs
github-actions / clippy
use Option::map_or_else instead of an if let/else
warning: use Option::map_or_else instead of an if let/else
--> atat_derive/src/urc.rs:53:26
|
53 | let digest_arm = if let Some(parse_fn) = parse {
| __________________________^
54 | | quote! {
55 | | #parse_fn(&#code[..]),
56 | | }
... |
60 | | }
61 | | };
| |_________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_if_let_else
help: try
|
53 ~ let digest_arm = parse.map_or_else(|| quote! {
54 + atat::digest::parser::urc_helper(&#code[..]),
55 + }, |parse_fn| quote! {
56 + #parse_fn(&#code[..]),
57 ~ });
|
Check warning on line 55 in atat_derive/src/helpers.rs
github-actions / clippy
`iter` call on a collection with only one item
warning: `iter` call on a collection with only one item
--> atat_derive/src/helpers.rs:55:17
|
55 | bounds: [trait_bound].iter().cloned().collect(),
| ^^^^^^^^^^^^^^^^^^^^ help: try: `std::iter::once(&trait_bound)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#iter_on_single_items
= note: `-W clippy::iter-on-single-items` implied by `-W clippy::nursery`
= help: to override `-W clippy::nursery` add `#[allow(clippy::iter_on_single_items)]`
Check warning on line 69 in atat/src/blocking/client.rs
github-actions / clippy
this argument is a mutable reference, but not used mutably
warning: this argument is a mutable reference, but not used mutably
--> atat/src/blocking/client.rs:69:9
|
69 | &'guard mut self,
| ^^^^^^^^^^^^^^^^ help: consider changing to: `&self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut
Check warning on line 69 in atat/src/asynch/client.rs
github-actions / clippy
this argument is a mutable reference, but not used mutably
warning: this argument is a mutable reference, but not used mutably
--> atat/src/asynch/client.rs:69:9
|
69 | &'guard mut self,
| ^^^^^^^^^^^^^^^^ help: consider changing to: `&self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut
= note: `-W clippy::needless-pass-by-ref-mut` implied by `-W clippy::nursery`
= help: to override `-W clippy::nursery` add `#[allow(clippy::needless_pass_by_ref_mut)]`
Check warning on line 117 in atat/src/blocking/client.rs
github-actions / clippy
unnecessary boolean `not` operation
warning: unnecessary boolean `not` operation
--> atat/src/blocking/client.rs:111:9
|
111 | / if !Cmd::EXPECTS_RESPONSE_CODE {
112 | | cmd.parse(Ok(&[]))
113 | | } else {
114 | | let response = self.wait_response(Duration::from_millis(Cmd::MAX_TIMEOUT_MS.into()))?;
115 | | let response: &Response<INGRESS_BUF_SIZE> = &response.borrow();
116 | | cmd.parse(response.into())
117 | | }
| |_________^
|
= help: remove the `!` and swap the blocks of the `if`/`else`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_not_else
Check warning on line 109 in atat/src/blocking/client.rs
github-actions / clippy
this expression creates a reference which is immediately dereferenced by the compiler
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> atat/src/blocking/client.rs:109:29
|
109 | let len = cmd.write(&mut self.buf);
| ^^^^^^^^^^^^^ help: change this to: `self.buf`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
Check warning on line 114 in atat/src/blocking/client.rs
github-actions / clippy
temporary with significant `Drop` can be early dropped
warning: temporary with significant `Drop` can be early dropped
--> atat/src/blocking/client.rs:114:17
|
113 | } else {
| ________________-
114 | | let response = self.wait_response(Duration::from_millis(Cmd::MAX_TIMEOUT_MS.into()))?;
| | ^^^^^^^^
115 | | let response: &Response<INGRESS_BUF_SIZE> = &response.borrow();
116 | | cmd.parse(response.into())
117 | | }
| |_________- temporary `response` is currently being dropped at the end of its contained scope
|
= note: this might lead to unnecessary resource contention
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#significant_drop_tightening
help: merge the temporary construction with its single usage
|
114 ~
115 + let response = self.wait_response(Duration::from_millis(Cmd::MAX_TIMEOUT_MS.into()))?.;
|
help: remove separated single usage
|
115 - let response: &Response<INGRESS_BUF_SIZE> = &response.borrow();
|
Check warning on line 68 in atat/src/blocking/client.rs
github-actions / clippy
the following explicit lifetimes could be elided: 'guard
warning: the following explicit lifetimes could be elided: 'guard
--> atat/src/blocking/client.rs:68:22
|
68 | fn wait_response<'guard>(
| ^^^^^^
69 | &'guard mut self,
| ^^^^^^
70 | timeout: Duration,
71 | ) -> Result<ResponseSlotGuard<'guard, INGRESS_BUF_SIZE>, Error> {
| ^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
|
68 ~ fn wait_response(
69 ~ &mut self,
70 | timeout: Duration,
71 ~ ) -> Result<ResponseSlotGuard<'_, INGRESS_BUF_SIZE>, Error> {
|
Check warning on line 15 in atat/src/blocking/client.rs
github-actions / clippy
first doc comment paragraph is too long
warning: first doc comment paragraph is too long
--> atat/src/blocking/client.rs:11:1
|
11 | / /// Client responsible for handling send, receive and timeout from the
12 | | /// userfacing side. The client is decoupled from the ingress-manager through
13 | | /// some spsc queue consumers, where any received responses can be dequeued. The
14 | | /// Client also has an spsc producer, to allow signaling commands like
15 | | /// `reset` to the ingress-manager.
| |_^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_long_first_doc_paragraph
= note: `-W clippy::too-long-first-doc-paragraph` implied by `-W clippy::nursery`
= help: to override `-W clippy::nursery` add `#[allow(clippy::too_long_first_doc_paragraph)]`
Check warning on line 43 in atat/src/asynch/mod.rs
github-actions / clippy
future cannot be sent between threads safely
warning: future cannot be sent between threads safely
--> atat/src/asynch/mod.rs:43:5
|
43 | async fn send<Cmd: AtatCmd>(&mut self, cmd: &Cmd) -> Result<Cmd::Response, Error> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `send` is not `Send`
|
note: future is not `Send` as it awaits another future which is not `Send`
--> atat/src/asynch/mod.rs:44:9
|
44 | T::send(self, cmd).await
| ^^^^^^^^^^^^^^^^^^ await occurs here on type `impl futures::Future<Output = core::result::Result<<Cmd as traits::AtatCmd>::Response, error::Error>>`, which is not `Send`
= note: `impl futures::Future<Output = core::result::Result<<Cmd as traits::AtatCmd>::Response, error::Error>>` doesn't implement `core::marker::Send`
note: captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync`
--> atat/src/asynch/mod.rs:43:44
|
43 | async fn send<Cmd: AtatCmd>(&mut self, cmd: &Cmd) -> Result<Cmd::Response, Error> {
| ^^^ has type `&Cmd` which is not `Send`, because `Cmd` is not `Sync`
= note: `Cmd` doesn't implement `core::marker::Sync`
note: captured value is not `Send` because `&mut` references cannot be sent unless their referent is `Send`
--> atat/src/asynch/mod.rs:43:33
|
43 | async fn send<Cmd: AtatCmd>(&mut self, cmd: &Cmd) -> Result<Cmd::Response, Error> {
| ^^^^^^^^^ has type `&mut &mut T` which is not `Send`, because `&mut T` is not `Send`
= note: `T` doesn't implement `core::marker::Send`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#future_not_send
Check warning on line 160 in atat/src/asynch/simple_client.rs
github-actions / clippy
unnecessary boolean `not` operation
warning: unnecessary boolean `not` operation
--> atat/src/asynch/simple_client.rs:149:9
|
149 | / if !Cmd::EXPECTS_RESPONSE_CODE {
150 | | cmd.parse(Ok(&[]))
151 | | } else {
152 | | let response = embassy_time::with_timeout(
... |
159 | | cmd.parse((&response).into())
160 | | }
| |_________^
|
= help: remove the `!` and swap the blocks of the `if`/`else`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_not_else
Check warning on line 146 in atat/src/asynch/simple_client.rs
github-actions / clippy
this expression creates a reference which is immediately dereferenced by the compiler
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> atat/src/asynch/simple_client.rs:146:29
|
146 | let len = cmd.write(&mut self.buf);
| ^^^^^^^^^^^^^ help: change this to: `self.buf`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
Check warning on line 145 in atat/src/asynch/simple_client.rs
github-actions / clippy
future cannot be sent between threads safely
warning: future cannot be sent between threads safely
--> atat/src/asynch/simple_client.rs:145:5
|
145 | async fn send<Cmd: AtatCmd>(&mut self, cmd: &Cmd) -> Result<Cmd::Response, Error> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `send` is not `Send`
|
note: future is not `Send` as this value is used across an await
--> atat/src/asynch/simple_client.rs:148:32
|
145 | async fn send<Cmd: AtatCmd>(&mut self, cmd: &Cmd) -> Result<Cmd::Response, Error> {
| --- has type `&Cmd` which is not `Send`
...
148 | self.send_request(len).await?;
| ^^^^^ await occurs here, with `cmd` maybe used later
= note: `Cmd` doesn't implement `core::marker::Sync`
note: future is not `Send` as this value is used across an await
--> atat/src/asynch/simple_client.rs:148:32
|
145 | async fn send<Cmd: AtatCmd>(&mut self, cmd: &Cmd) -> Result<Cmd::Response, Error> {
| --------- has type `&mut asynch::simple_client::SimpleClient<'_, RW, D>` which is not `Send`
...
148 | self.send_request(len).await?;
| ^^^^^ await occurs here, with `&mut self` maybe used later
= note: `RW` doesn't implement `core::marker::Send`
note: future is not `Send` as this value is used across an await
--> atat/src/asynch/simple_client.rs:148:32
|
145 | async fn send<Cmd: AtatCmd>(&mut self, cmd: &Cmd) -> Result<Cmd::Response, Error> {
| --------- has type `&mut asynch::simple_client::SimpleClient<'_, RW, D>` which is not `Send`
...
148 | self.send_request(len).await?;
| ^^^^^ await occurs here, with `&mut self` maybe used later
= note: `D` doesn't implement `core::marker::Send`
= note: `impl futures::Future<Output = core::result::Result<(), <RW as embedded_io::ErrorType>::Error>>` doesn't implement `core::marker::Send`
= note: `impl futures::Future<Output = core::result::Result<(), <RW as embedded_io::ErrorType>::Error>>` doesn't implement `core::marker::Send`
note: future is not `Send` as it awaits another future which is not `Send`
--> atat/src/asynch/simple_client.rs:53:19
|
53 | match self.rw.read(&mut self.buf[self.pos..]).await {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ await occurs here on type `impl futures::Future<Output = core::result::Result<usize, <RW as embedded_io::ErrorType>::Error>>`, which is not `Send`
= note: `impl futures::Future<Output = core::result::Result<usize, <RW as embedded_io::ErrorType>::Error>>` doesn't implement `core::marker::Send`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#future_not_send
Check warning on line 139 in atat/src/asynch/simple_client.rs
github-actions / clippy
consider adding a `;` to the last statement for consistent formatting
warning: consider adding a `;` to the last statement for consistent formatting
--> atat/src/asynch/simple_client.rs:139:13
|
139 | cooldown.await
| ^^^^^^^^^^^^^^ help: add a `;` here: `cooldown.await;`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
Check warning on line 137 in atat/src/asynch/simple_client.rs
github-actions / clippy
future cannot be sent between threads safely
warning: future cannot be sent between threads safely
--> atat/src/asynch/simple_client.rs:137:5
|
137 | async fn wait_cooldown_timer(&mut self) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `wait_cooldown_timer` is not `Send`
|
note: captured value is not `Send` because `&mut` references cannot be sent unless their referent is `Send`
--> atat/src/asynch/simple_client.rs:137:34
|
137 | async fn wait_cooldown_timer(&mut self) {
| ^^^^^^^^^ has type `&mut asynch::simple_client::SimpleClient<'a, RW, D>` which is not `Send`, because `asynch::simple_client::SimpleClient<'a, RW, D>` is not `Send`
= note: `RW` doesn't implement `core::marker::Send`
note: captured value is not `Send` because `&mut` references cannot be sent unless their referent is `Send`
--> atat/src/asynch/simple_client.rs:137:34
|
137 | async fn wait_cooldown_timer(&mut self) {
| ^^^^^^^^^ has type `&mut asynch::simple_client::SimpleClient<'a, RW, D>` which is not `Send`, because `asynch::simple_client::SimpleClient<'a, RW, D>` is not `Send`
= note: `D` doesn't implement `core::marker::Send`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#future_not_send
Check warning on line 92 in atat/src/asynch/simple_client.rs
github-actions / clippy
consider adding a `;` to the last statement for consistent formatting
warning: consider adding a `;` to the last statement for consistent formatting
--> atat/src/asynch/simple_client.rs:92:37
|
92 | ... debug!("Received OK ({}/{})", swallowed, self.pos)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `debug!("Received OK ({}/{})", swallowed, self.pos);`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
Check warning on line 51 in atat/src/asynch/simple_client.rs
github-actions / clippy
future cannot be sent between threads safely
warning: future cannot be sent between threads safely
--> atat/src/asynch/simple_client.rs:51:5
|
51 | async fn wait_response<'guard>(&'guard mut self) -> Result<Response<256>, Error> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `wait_response` is not `Send`
|
note: future is not `Send` as it awaits another future which is not `Send`
--> atat/src/asynch/simple_client.rs:53:19
|
53 | match self.rw.read(&mut self.buf[self.pos..]).await {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ await occurs here on type `impl futures::Future<Output = core::result::Result<usize, <RW as embedded_io::ErrorType>::Error>>`, which is not `Send`
= note: `impl futures::Future<Output = core::result::Result<usize, <RW as embedded_io::ErrorType>::Error>>` doesn't implement `core::marker::Send`
note: future is not `Send` as this value is used across an await
--> atat/src/asynch/simple_client.rs:53:59
|
51 | async fn wait_response<'guard>(&'guard mut self) -> Result<Response<256>, Error> {
| ---------------- has type `&mut asynch::simple_client::SimpleClient<'a, RW, D>` which is not `Send`
52 | loop {
53 | match self.rw.read(&mut self.buf[self.pos..]).await {
| ^^^^^ await occurs here, with `&'guard mut self` maybe used later
= note: `RW` doesn't implement `core::marker::Send`
note: future is not `Send` as this value is used across an await
--> atat/src/asynch/simple_client.rs:53:59
|
51 | async fn wait_response<'guard>(&'guard mut self) -> Result<Response<256>, Error> {
| ---------------- has type `&mut asynch::simple_client::SimpleClient<'a, RW, D>` which is not `Send`
52 | loop {
53 | match self.rw.read(&mut self.buf[self.pos..]).await {
| ^^^^^ await occurs here, with `&'guard mut self` maybe used later
= note: `D` doesn't implement `core::marker::Send`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#future_not_send
Check warning on line 51 in atat/src/asynch/simple_client.rs
github-actions / clippy
the following explicit lifetimes could be elided: 'guard
warning: the following explicit lifetimes could be elided: 'guard
--> atat/src/asynch/simple_client.rs:51:28
|
51 | async fn wait_response<'guard>(&'guard mut self) -> Result<Response<256>, Error> {
| ^^^^^^ ^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
Check warning on line 27 in atat/src/asynch/simple_client.rs
github-actions / clippy
future cannot be sent between threads safely
warning: future cannot be sent between threads safely
--> atat/src/asynch/simple_client.rs:27:5
|
27 | async fn send_request(&mut self, len: usize) -> Result<(), Error> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `send_request` is not `Send`
|
note: future is not `Send` as this value is used across an await
--> atat/src/asynch/simple_client.rs:34:36
|
27 | async fn send_request(&mut self, len: usize) -> Result<(), Error> {
| --------- has type `&mut asynch::simple_client::SimpleClient<'a, RW, D>` which is not `Send`
...
34 | self.wait_cooldown_timer().await;
| ^^^^^ await occurs here, with `&mut self` maybe used later
= note: `RW` doesn't implement `core::marker::Send`
note: future is not `Send` as this value is used across an await
--> atat/src/asynch/simple_client.rs:34:36
|
27 | async fn send_request(&mut self, len: usize) -> Result<(), Error> {
| --------- has type `&mut asynch::simple_client::SimpleClient<'a, RW, D>` which is not `Send`
...
34 | self.wait_cooldown_timer().await;
| ^^^^^ await occurs here, with `&mut self` maybe used later
= note: `D` doesn't implement `core::marker::Send`
= note: `impl futures::Future<Output = core::result::Result<(), <RW as embedded_io::ErrorType>::Error>>` doesn't implement `core::marker::Send`
= note: `impl futures::Future<Output = core::result::Result<(), <RW as embedded_io::ErrorType>::Error>>` doesn't implement `core::marker::Send`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#future_not_send