Protect against busy-loop in Ingress::read_from (#212) #491
clippy
182 warnings
Details
Results
Message level | Amount |
---|---|
Internal compiler error | 0 |
Error | 0 |
Warning | 182 |
Note | 0 |
Help | 0 |
Versions
- rustc 1.81.0 (eeb90cda1 2024-09-04)
- cargo 1.81.0 (2dbb1af80 2024-08-20)
- clippy 0.1.81 (eeb90cd 2024-09-04)
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`: 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 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 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 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 155 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:144:9
|
144 | / if !Cmd::EXPECTS_RESPONSE_CODE {
145 | | cmd.parse(Ok(&[]))
146 | | } else {
147 | | let response = embassy_time::with_timeout(
... |
154 | | cmd.parse((&response).into())
155 | | }
| |_________^
|
= 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 141 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:141:29
|
141 | 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 140 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:140:5
|
140 | 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:143:32
|
140 | async fn send<Cmd: AtatCmd>(&mut self, cmd: &Cmd) -> Result<Cmd::Response, Error> {
| --- has type `&Cmd` which is not `Send`
...
143 | 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:143:32
|
140 | 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`
...
143 | 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:143:32
|
140 | 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`
...
143 | 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 134 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:134:13
|
134 | 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 132 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:132:5
|
132 | 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:132:34
|
132 | 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:132:34
|
132 | 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 88 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:88:37
|
88 | ... 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 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
Check warning on line 125 in atat/src/asynch/client.rs
github-actions / clippy
unnecessary boolean `not` operation
warning: unnecessary boolean `not` operation
--> atat/src/asynch/client.rs:117:9
|
117 | / if !Cmd::EXPECTS_RESPONSE_CODE {
118 | | cmd.parse(Ok(&[]))
119 | | } else {
120 | | let response = self
... |
124 | | cmd.parse(response.into())
125 | | }
| |_________^
|
= 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
= note: `-W clippy::if-not-else` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::if_not_else)]`
Check warning on line 115 in atat/src/asynch/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/client.rs:115:29
|
115 | 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
= note: `-W clippy::needless-borrow` implied by `-W clippy::all`
= help: to override `-W clippy::all` add `#[allow(clippy::needless_borrow)]`
Check warning on line 120 in atat/src/asynch/client.rs
github-actions / clippy
temporary with significant `Drop` can be early dropped
warning: temporary with significant `Drop` can be early dropped
--> atat/src/asynch/client.rs:120:17
|
119 | } else {
| ________________-
120 | | let response = self
| | ^^^^^^^^
121 | | .wait_response(Duration::from_millis(Cmd::MAX_TIMEOUT_MS.into()))
122 | | .await?;
123 | | let response: &Response<INGRESS_BUF_SIZE> = &response.borrow();
124 | | cmd.parse(response.into())
125 | | }
| |_________- 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
|
120 ~
121 + let response = self
122 + .wait_response(Duration::from_millis(Cmd::MAX_TIMEOUT_MS.into()))
123 + .await?.;
|
help: remove separated single usage
|
123 - let response: &Response<INGRESS_BUF_SIZE> = &response.borrow();
|