Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature(*): add a SimpleClient, that does request/response without background tasks and URC handling #203

Merged
merged 1 commit into from
Mar 15, 2024

Add a SimpleClient, that does request/response without background tas…

6153eaa
Select commit
Loading
Failed to load commit list.
Sign in for the full log view
Merged

feature(*): add a SimpleClient, that does request/response without background tasks and URC handling #203

Add a SimpleClient, that does request/response without background tas…
6153eaa
Select commit
Loading
Failed to load commit list.
GitHub Actions / clippy succeeded Feb 16, 2024 in 1s

clippy

64 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 0
Warning 64
Note 0
Help 0

Versions

  • rustc 1.76.0 (07dca489a 2024-02-04)
  • cargo 1.76.0 (c84b36747 2024-01-18)
  • clippy 0.1.76 (07dca48 2024-02-04)

Annotations

Check warning on line 6 in examples/src/common/general/mod.rs

See this annotation in the file changed.

@github-actions 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 117 in atat/src/blocking/client.rs

See this annotation in the file changed.

@github-actions 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

See this annotation in the file changed.

@github-actions 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 68 in atat/src/blocking/client.rs

See this annotation in the file changed.

@github-actions 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 151 in atat/src/asynch/simple_client.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unnecessary boolean `not` operation

warning: unnecessary boolean `not` operation
   --> atat/src/asynch/simple_client.rs:140:9
    |
140 | /         if !Cmd::EXPECTS_RESPONSE_CODE {
141 | |             cmd.parse(Ok(&[]))
142 | |         } else {
143 | |             let response = embassy_time::with_timeout(
...   |
150 | |             cmd.parse((&response).into())
151 | |         }
    | |_________^
    |
    = 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 137 in atat/src/asynch/simple_client.rs

See this annotation in the file changed.

@github-actions 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:137:29
    |
137 |         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 130 in atat/src/asynch/simple_client.rs

See this annotation in the file changed.

@github-actions 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:130:13
    |
130 |             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 84 in atat/src/asynch/simple_client.rs

See this annotation in the file changed.

@github-actions 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:84:37
   |
84 | ...                   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 118 in atat/src/asynch/client.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unnecessary boolean `not` operation

warning: unnecessary boolean `not` operation
   --> atat/src/asynch/client.rs:110:9
    |
110 | /         if !Cmd::EXPECTS_RESPONSE_CODE {
111 | |             cmd.parse(Ok(&[]))
112 | |         } else {
113 | |             let response = self
...   |
117 | |             cmd.parse(response.into())
118 | |         }
    | |_________^
    |
    = 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 108 in atat/src/asynch/client.rs

See this annotation in the file changed.

@github-actions 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:108:29
    |
108 |         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 101 in atat/src/asynch/client.rs

See this annotation in the file changed.

@github-actions 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/client.rs:101:13
    |
101 |             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 83 in atat/src/asynch/client.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

matching over `()` is more explicit

warning: matching over `()` is more explicit
  --> atat/src/asynch/client.rs:83:32
   |
83 |                 Either::Right((_, fut)) => {
   |                                ^ help: use `()` instead of `_`: `()`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns

Check warning on line 24 in atat/src/urc_channel.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this method could have a `#[must_use]` attribute

warning: this method could have a `#[must_use]` attribute
  --> atat/src/urc_channel.rs:24:5
   |
24 |     pub const fn new() -> Self {
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub const fn new() -> Self`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate

Check warning on line 114 in atat/src/traits.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

matching over `()` is more explicit

warning: matching over `()` is more explicit
   --> atat/src/traits.rs:114:48
    |
114 |         String::try_from(utf8_string).map_err(|_| Error::Parse)
    |                                                ^ help: use `()` instead of `_`: `()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns

Check warning on line 44 in atat/src/response_slot.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function which may panic missing `# Panics` section

warning: docs for function which may panic missing `# Panics` section
  --> atat/src/response_slot.rs:44:5
   |
44 |     pub fn try_get<'a>(&'a self) -> Option<ResponseSlotGuard<'a, N>> {
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: first possible panic found here
  --> atat/src/response_slot.rs:47:18
   |
47 |             Some(self.0.try_lock().unwrap())
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc

Check warning on line 44 in atat/src/response_slot.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

the following explicit lifetimes could be elided: 'a

warning: the following explicit lifetimes could be elided: 'a
  --> atat/src/response_slot.rs:44:20
   |
44 |     pub fn try_get<'a>(&'a self) -> Option<ResponseSlotGuard<'a, N>> {
   |                    ^^   ^^                                   ^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
   |
44 -     pub fn try_get<'a>(&'a self) -> Option<ResponseSlotGuard<'a, N>> {
44 +     pub fn try_get(&self) -> Option<ResponseSlotGuard<'_, N>> {
   |

Check warning on line 36 in atat/src/response_slot.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function which may panic missing `# Panics` section

warning: docs for function which may panic missing `# Panics` section
  --> atat/src/response_slot.rs:36:5
   |
36 |     pub async fn get<'a>(&'a self) -> ResponseSlotGuard<'a, N> {
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: first possible panic found here
  --> atat/src/response_slot.rs:40:9
   |
40 |         self.0.try_lock().unwrap()
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc

Check warning on line 36 in atat/src/response_slot.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

the following explicit lifetimes could be elided: 'a

warning: the following explicit lifetimes could be elided: 'a
  --> atat/src/response_slot.rs:36:22
   |
36 |     pub async fn get<'a>(&'a self) -> ResponseSlotGuard<'a, N> {
   |                      ^^   ^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
   = note: `-W clippy::needless-lifetimes` implied by `-W clippy::all`
   = help: to override `-W clippy::all` add `#[allow(clippy::needless_lifetimes)]`

Check warning on line 23 in atat/src/response_slot.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this method could have a `#[must_use]` attribute

warning: this method could have a `#[must_use]` attribute
  --> atat/src/response_slot.rs:23:5
   |
23 |     pub const fn new() -> Self {
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub const fn new() -> Self`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate

Check warning on line 75 in atat/src/response.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

use of a fallible conversion when an infallible one could be used

warning: use of a fallible conversion when an infallible one could be used
  --> atat/src/response.rs:75:57
   |
75 |                 Err(InternalError::ConnectionError((*e).try_into().unwrap()))
   |                                                         ^^^^^^^^^^^^^^^^^^^ help: use: `into()`
   |
   = note: converting `u8` to `ConnectionError` cannot fail
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_fallible_conversions

Check warning on line 73 in atat/src/response.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

use of a fallible conversion when an infallible one could be used

warning: use of a fallible conversion when an infallible one could be used
  --> atat/src/response.rs:73:71
   |
73 |             Response::CmsError(e) => Err(InternalError::CmsError((*e).try_into().unwrap())),
   |                                                                       ^^^^^^^^^^^^^^^^^^^ help: use: `into()`
   |
   = note: converting `u16` to `CmsError` cannot fail
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_fallible_conversions

Check warning on line 72 in atat/src/response.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

use of a fallible conversion when an infallible one could be used

warning: use of a fallible conversion when an infallible one could be used
  --> atat/src/response.rs:72:71
   |
72 |             Response::CmeError(e) => Err(InternalError::CmeError((*e).try_into().unwrap())),
   |                                                                       ^^^^^^^^^^^^^^^^^^^ help: use: `into()`
   |
   = note: converting `u16` to `CmeError` cannot fail
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_fallible_conversions
   = note: `-W clippy::unnecessary-fallible-conversions` implied by `-W clippy::all`
   = help: to override `-W clippy::all` add `#[allow(clippy::unnecessary_fallible_conversions)]`

Check warning on line 22 in atat/src/response.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function which may panic missing `# Panics` section

warning: docs for function which may panic missing `# Panics` section
  --> atat/src/response.rs:22:5
   |
22 |     pub fn ok(value: &[u8]) -> Self {
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: first possible panic found here
  --> atat/src/response.rs:23:22
   |
23 |         Response::Ok(Vec::from_slice(value).unwrap())
   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc

Check warning on line 22 in atat/src/response.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this method could have a `#[must_use]` attribute

warning: this method could have a `#[must_use]` attribute
  --> atat/src/response.rs:22:5
   |
22 |     pub fn ok(value: &[u8]) -> Self {
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn ok(value: &[u8]) -> Self`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate

Check warning on line 4 in atat/src/response.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

you are deriving `PartialEq` and can implement `Eq`

warning: you are deriving `PartialEq` and can implement `Eq`
 --> atat/src/response.rs:4:24
  |
4 | #[derive(Debug, Clone, PartialEq)]
  |                        ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq