feature(CI): Add test for AWS IoT Device Advisor #162
ci.yml
on: pull_request
Test
25s
Cancel previous runs
2s
rustfmt
11s
clippy
22s
Coverage
1m 42s
Documentation
13s
Annotations
6 errors and 342 warnings
Test:
mqttrust_core/src/eventloop.rs#L733
mismatched types
|
Test:
mqttrust_core/src/eventloop.rs#L733
`fn(mqttrust::encoding::v4::Connack) -> Notification {Notification::ConnAck}` doesn't implement `std::fmt::Debug`
|
Test
The process '/home/runner/.cargo/bin/cargo' failed with exit code 101
|
Coverage:
mqttrust_core/src/eventloop.rs#L733
mismatched types
|
Coverage:
mqttrust_core/src/eventloop.rs#L733
`fn(mqttrust::encoding::v4::Connack) -> Notification {Notification::ConnAck}` doesn't implement `std::fmt::Debug`
|
Coverage
The process '/home/runner/.cargo/bin/cargo' failed with exit code 101
|
Cancel previous runs
Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: styfle/[email protected]. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.
|
Cancel previous runs
The following actions uses node12 which is deprecated and will be forced to run on node16: styfle/[email protected]. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
|
Documentation
Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: actions/checkout@v2, actions-rs/toolchain@v1, actions-rs/cargo@v1. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.
|
Documentation
The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2, actions-rs/toolchain@v1, actions-rs/cargo@v1. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
|
Documentation
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/
|
Documentation
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/
|
Documentation
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/
|
Documentation
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/
|
Documentation:
mqttrust/src/fmt.rs#L226
method `into_result` is never used
|
Documentation
`mqttrust` (lib) generated 1 warning
|
rustfmt
Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: actions/checkout@v2, actions-rs/toolchain@v1, actions-rs/cargo@v1. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.
|
rustfmt
The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2, actions-rs/toolchain@v1, actions-rs/cargo@v1. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
|
rustfmt
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/
|
rustfmt
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/
|
rustfmt
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/
|
rustfmt
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/
|
unnecessary structure name repetition:
mqttrust_core/src/lib.rs#L115
warning: unnecessary structure name repetition
--> mqttrust_core/src/lib.rs:115:9
|
115 | EventError::MqttState(e)
| ^^^^^^^^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
unnecessary structure name repetition:
mqttrust_core/src/lib.rs#L109
warning: unnecessary structure name repetition
--> mqttrust_core/src/lib.rs:109:9
|
109 | EventError::Encoding(e)
| ^^^^^^^^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
you are deriving `PartialEq` and can implement `Eq`:
mqttrust_core/src/lib.rs#L95
warning: you are deriving `PartialEq` and can implement `Eq`
--> mqttrust_core/src/lib.rs:95:17
|
95 | #[derive(Debug, 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
|
matching over `()` is more explicit:
mqttrust_core/src/lib.rs#L74
warning: matching over `()` is more explicit
--> mqttrust_core/src/lib.rs:74:58
|
74 | payload: Vec::from_slice(p.payload).map_err(|_| {
| ^ help: use `()` instead of `_`: `()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns
= note: `-W clippy::ignored-unit-patterns` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::ignored_unit_patterns)]`
|
unnecessary structure name repetition:
mqttrust_core/src/lib.rs#L69
warning: unnecessary structure name repetition
--> mqttrust_core/src/lib.rs:69:12
|
69 | Ok(PublishNotification {
| ^^^^^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
you are deriving `PartialEq` and can implement `Eq`:
mqttrust_core/src/lib.rs#L27
warning: you are deriving `PartialEq` and can implement `Eq`
--> mqttrust_core/src/lib.rs:27:17
|
27 | #[derive(Debug, 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
|
the following explicit lifetimes could be elided: 'b:
mqttrust_core/src/state.rs#L484
warning: the following explicit lifetimes could be elided: 'b
--> mqttrust_core/src/state.rs:484:26
|
484 | pub(crate) fn packet<'b>(&'b mut self, pid: u16) -> Result<&'b [u8], StateError> {
| ^^ ^^ ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
|
484 - pub(crate) fn packet<'b>(&'b mut self, pid: u16) -> Result<&'b [u8], StateError> {
484 + pub(crate) fn packet(&mut self, pid: u16) -> Result<&[u8], StateError> {
|
|
item in documentation is missing backticks:
mqttrust_core/src/state.rs#L457
warning: item in documentation is missing backticks
--> mqttrust_core/src/state.rs:457:31
|
457 | /// A publish of non-zero QoS.
| ^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
|
457 | /// A publish of non-zero `QoS`.
| ~~~~~
|
pub(crate) struct inside private module:
mqttrust_core/src/state.rs#L456
warning: pub(crate) struct inside private module
--> mqttrust_core/src/state.rs:456:1
|
456 | pub(crate) struct Inflight<const TIMER_HZ: u32, const L: usize> {
| ----------^^^^^^^^^^^^^^^^
| |
| help: consider using: `pub`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pub_crate
= note: `-W clippy::redundant-pub-crate` implied by `-W clippy::nursery`
= help: to override `-W clippy::nursery` add `#[allow(clippy::redundant_pub_crate)]`
|
use Option::map_or instead of an if let/else:
mqttrust_core/src/state.rs#L445
warning: use Option::map_or instead of an if let/else
--> mqttrust_core/src/state.rs:445:9
|
445 | / if let Some(start_time) = self.0 {
446 | | let elapse_time = start_time + interval;
447 | | elapse_time <= *now
448 | | } else {
449 | | false
450 | | }
| |_________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_if_let_else
help: try
|
445 ~ self.0.map_or(false, |start_time| {
446 + let elapse_time = start_time + interval;
447 + elapse_time <= *now
448 + })
|
|
this argument (4 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte):
mqttrust_core/src/state.rs#L442
warning: this argument (4 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
--> mqttrust_core/src/state.rs:442:14
|
442 | now: &TimerInstantU32<TIMER_HZ>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider passing by value instead: `TimerInstantU32<TIMER_HZ>`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref
|
this argument (8 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte):
mqttrust_core/src/state.rs#L441
warning: this argument (8 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
--> mqttrust_core/src/state.rs:441:9
|
441 | &self,
| ^^^^^ help: consider passing by value instead: `self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref
|
this function's return value is unnecessarily wrapped by `Result`:
mqttrust_core/src/state.rs#L354
warning: this function's return value is unnecessarily wrapped by `Result`
--> mqttrust_core/src/state.rs:354:5
|
354 | / fn handle_incoming_pingresp(
355 | | &mut self,
356 | | ) -> Result<(Option<Notification>, Option<Packet<'static>>), StateError> {
357 | | self.await_pingresp = false;
358 | | trace!("Received Pingresp");
359 | | Ok((None, None))
360 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_wraps
help: remove `Result` from the return type...
|
356 | ) -> (core::option::Option<Notification>, core::option::Option<mqttrust::Packet<'static>>) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: ...and then change returning expressions
|
359 | (None, None)
|
|
this function's return value is unnecessarily wrapped by `Result`:
mqttrust_core/src/state.rs#L321
warning: this function's return value is unnecessarily wrapped by `Result`
--> mqttrust_core/src/state.rs:321:5
|
321 | / fn handle_incoming_pubcomp(
322 | | &mut self,
323 | | pid: Pid,
324 | | ) -> Result<(Option<Notification>, Option<Packet<'static>>), StateError> {
... |
334 | | }
335 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_wraps
help: remove `Result` from the return type...
|
324 | ) -> (core::option::Option<Notification>, core::option::Option<mqttrust::Packet<'static>>) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: ...and then change returning expressions
|
329 ~ (notification, reply)
330 | } else {
331 | error!("Unsolicited pubcomp packet: {:?}", pid.get());
332 | // Err(StateError::Unsolicited)
333 ~ (None, None)
|
|
this function's return value is unnecessarily wrapped by `Result`:
mqttrust_core/src/state.rs#L306
warning: this function's return value is unnecessarily wrapped by `Result`
--> mqttrust_core/src/state.rs:306:5
|
306 | / fn handle_incoming_pubrel(
307 | | &mut self,
308 | | pid: Pid,
309 | | ) -> Result<(Option<Notification>, Option<Packet<'static>>), StateError> {
... |
318 | | }
319 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_wraps
help: remove `Result` from the return type...
|
309 | ) -> (core::option::Option<Notification>, core::option::Option<mqttrust::Packet<'static>>) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: ...and then change returning expressions
|
313 ~ (None, Some(reply))
314 | } else {
315 | error!("Unsolicited pubrel packet: {:?}", pid.get());
316 | // Err(StateError::Unsolicited)
317 ~ (None, None)
|
|
item in documentation is missing backticks:
mqttrust_core/src/state.rs#L264
warning: item in documentation is missing backticks
--> mqttrust_core/src/state.rs:264:51
|
264 | /// in case of QoS1 and Replys rec in case of QoS while also storing the message
| ^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
|
264 | /// in case of QoS1 and Replys rec in case of `QoS` while also storing the message
| ~~~~~
|
item in documentation is missing backticks:
mqttrust_core/src/state.rs#L264
warning: item in documentation is missing backticks
--> mqttrust_core/src/state.rs:264:20
|
264 | /// in case of QoS1 and Replys rec in case of QoS while also storing the message
| ^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
|
264 | /// in case of `QoS1` and Replys rec in case of QoS while also storing the message
| ~~~~~~
|
item in documentation is missing backticks:
mqttrust_core/src/state.rs#L263
warning: item in documentation is missing backticks
--> mqttrust_core/src/state.rs:263:54
|
263 | /// Results in a publish notification in all the QoS cases. Replys with an ack
| ^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
|
263 | /// Results in a publish notification in all the `QoS` cases. Replys with an ack
| ~~~~~
|
the following explicit lifetimes could be elided: 'b:
mqttrust_core/src/state.rs#L265
warning: the following explicit lifetimes could be elided: 'b
--> mqttrust_core/src/state.rs:265:32
|
265 | fn handle_incoming_publish<'b>(
| ^^
266 | &mut self,
267 | publish: Publish<'b>,
| ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
|
265 ~ fn handle_incoming_publish(
266 | &mut self,
267 ~ publish: Publish<'_>,
|
|
this function's return value is unnecessarily wrapped by `Result`:
mqttrust_core/src/state.rs#L229
warning: this function's return value is unnecessarily wrapped by `Result`
--> mqttrust_core/src/state.rs:229:5
|
229 | / fn handle_incoming_unsuback(
230 | | &mut self,
231 | | pid: Pid,
232 | | ) -> Result<(Option<Notification>, Option<Packet<'static>>), StateError> {
... |
236 | | Ok((notification, request))
237 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_wraps
help: remove `Result` from the return type...
|
232 | ) -> (core::option::Option<Notification>, core::option::Option<mqttrust::Packet<'static>>) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: ...and then change returning expressions
|
236 | (notification, request)
|
|
unused `self` argument:
mqttrust_core/src/state.rs#L230
warning: unused `self` argument
--> mqttrust_core/src/state.rs:230:9
|
230 | &mut self,
| ^^^^^^^^^
|
= help: consider refactoring to an associated function
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_self
|
this function's return value is unnecessarily wrapped by `Result`:
mqttrust_core/src/state.rs#L218
warning: this function's return value is unnecessarily wrapped by `Result`
--> mqttrust_core/src/state.rs:218:5
|
218 | / fn handle_incoming_suback<'a>(
219 | | &mut self,
220 | | suback: Suback<'a>,
221 | | ) -> Result<(Option<Notification>, Option<Packet<'static>>), StateError> {
... |
226 | | Ok((notification, request))
227 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_wraps
help: remove `Result` from the return type...
|
221 | ) -> (core::option::Option<Notification>, core::option::Option<mqttrust::Packet<'static>>) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: ...and then change returning expressions
|
226 | (notification, request)
|
|
this argument is passed by value, but not consumed in the function body:
mqttrust_core/src/state.rs#L220
warning: this argument is passed by value, but not consumed in the function body
--> mqttrust_core/src/state.rs:220:17
|
220 | suback: Suback<'a>,
| ^^^^^^^^^^ help: consider taking a reference instead: `&Suback<'a>`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_value
|
unused `self` argument:
mqttrust_core/src/state.rs#L219
warning: unused `self` argument
--> mqttrust_core/src/state.rs:219:9
|
219 | &mut self,
| ^^^^^^^^^
|
= help: consider refactoring to an associated function
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_self
= note: `-W clippy::unused-self` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::unused_self)]`
|
the following explicit lifetimes could be elided: 'a:
mqttrust_core/src/state.rs#L218
warning: the following explicit lifetimes could be elided: 'a
--> mqttrust_core/src/state.rs:218:31
|
218 | fn handle_incoming_suback<'a>(
| ^^
219 | &mut self,
220 | suback: Suback<'a>,
| ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
|
218 ~ fn handle_incoming_suback(
219 | &mut self,
220 ~ suback: Suback<'_>,
|
|
this function's return value is unnecessarily wrapped by `Result`:
mqttrust_core/src/state.rs#L200
warning: this function's return value is unnecessarily wrapped by `Result`
--> mqttrust_core/src/state.rs:200:5
|
200 | / fn handle_incoming_puback(
201 | | &mut self,
202 | | pid: Pid,
203 | | ) -> Result<(Option<Notification>, Option<Packet<'static>>), StateError> {
... |
215 | | }
216 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_wraps
= note: `-W clippy::unnecessary-wraps` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::unnecessary_wraps)]`
help: remove `Result` from the return type...
|
203 | ) -> (core::option::Option<Notification>, core::option::Option<mqttrust::Packet<'static>>) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: ...and then change returning expressions
|
210 ~ (notification, request)
211 | } else {
212 | error!("Unsolicited puback packet: {:?}", pid.get());
213 | // Err(StateError::Unsolicited)
214 ~ (None, None)
|
|
this expression creates a reference which is immediately dereferenced by the compiler:
mqttrust_core/src/state.rs#L187
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> mqttrust_core/src/state.rs:187:76
|
187 | .insert(pid.get(), Inflight::new(StartTime::new(*now), &request.0))
| ^^^^^^^^^^ help: change this to: `request.0`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
mqttrust_core/src/state.rs#L179
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> mqttrust_core/src/state.rs:179:76
|
179 | .insert(pid.get(), Inflight::new(StartTime::new(*now), &request.0))
| ^^^^^^^^^^ help: change this to: `request.0`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this argument (4 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte):
mqttrust_core/src/state.rs#L169
warning: this argument (4 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
--> mqttrust_core/src/state.rs:169:14
|
169 | now: &TimerInstantU32<TIMER_HZ>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider passing by value instead: `TimerInstantU32<TIMER_HZ>`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref
|
item in documentation is missing backticks:
mqttrust_core/src/state.rs#L164
warning: item in documentation is missing backticks
--> mqttrust_core/src/state.rs:164:40
|
164 | /// Adds next packet identifier to QoS 1 and 2 publish packets and returns
| ^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
|
164 | /// Adds next packet identifier to `QoS` 1 and 2 publish packets and returns
| ~~~~~
|
item in documentation is missing backticks:
mqttrust_core/src/state.rs#L138
warning: item in documentation is missing backticks
--> mqttrust_core/src/state.rs:138:58
|
138 | /// eventloop to put on the network E.g For incoming QoS1 publish packet,
| ^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
|
138 | /// eventloop to put on the network E.g For incoming `QoS1` publish packet,
| ~~~~~~
|
the following explicit lifetimes could be elided: 'b:
mqttrust_core/src/state.rs#L141
warning: the following explicit lifetimes could be elided: 'b
--> mqttrust_core/src/state.rs:141:35
|
141 | pub fn handle_incoming_packet<'b>(
| ^^
142 | &mut self,
143 | packet: Packet<'b>,
| ^^
|
= 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)]`
help: elide the lifetimes
|
141 ~ pub fn handle_incoming_packet(
142 | &mut self,
143 ~ packet: Packet<'_>,
|
|
consider adding a `;` to the last statement for consistent formatting:
mqttrust_core/src/state.rs#L128
warning: consider adding a `;` to the last statement for consistent formatting
--> mqttrust_core/src/state.rs:128:17
|
128 | request.set_pid(pid)?
| ^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `request.set_pid(pid)?;`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
|
consider adding a `;` to the last statement for consistent formatting:
mqttrust_core/src/state.rs#L123
warning: consider adding a `;` to the last statement for consistent formatting
--> mqttrust_core/src/state.rs:123:17
|
123 | request.set_pid(pid)?
| ^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `request.set_pid(pid)?;`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
= note: `-W clippy::semicolon-if-nothing-returned` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::semicolon_if_nothing_returned)]`
|
this argument (4 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte):
mqttrust_core/src/state.rs#L116
warning: this argument (4 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
--> mqttrust_core/src/state.rs:116:14
|
116 | now: &TimerInstantU32<TIMER_HZ>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider passing by value instead: `TimerInstantU32<TIMER_HZ>`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref
= note: `-W clippy::trivially-copy-pass-by-ref` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::trivially_copy_pass_by_ref)]`
|
this argument is passed by value, but not consumed in the function body:
mqttrust_core/src/state.rs#L103
warning: this argument is passed by value, but not consumed in the function body
--> mqttrust_core/src/state.rs:103:17
|
103 | packet: Packet<'b>,
| ^^^^^^^^^^ help: consider taking a reference instead: `&Packet<'b>`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_value
|
unnecessary structure name repetition:
mqttrust_core/src/state.rs#L87
warning: unnecessary structure name repetition
--> mqttrust_core/src/state.rs:87:9
|
87 | MqttState {
| ^^^^^^^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
item in documentation is missing backticks:
mqttrust_core/src/state.rs#L66
warning: item in documentation is missing backticks
--> mqttrust_core/src/state.rs:66:32
|
66 | /// Packet ids on incoming QoS 2 publishes
| ^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
|
66 | /// Packet ids on incoming `QoS` 2 publishes
| ~~~~~
|
item in documentation is missing backticks:
mqttrust_core/src/state.rs#L64
warning: item in documentation is missing backticks
--> mqttrust_core/src/state.rs:64:32
|
64 | /// Packet ids of released QoS 2 publishes
| ^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
|
64 | /// Packet ids of released `QoS` 2 publishes
| ~~~~~
|
item in documentation is missing backticks:
mqttrust_core/src/state.rs#L62
warning: item in documentation is missing backticks
--> mqttrust_core/src/state.rs:62:18
|
62 | /// Outgoing QoS 1, 2 publishes which aren't acked yet
| ^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
|
62 | /// Outgoing `QoS` 1, 2 publishes which aren't acked yet
| ~~~~~
|
item name ends with its containing module's name:
mqttrust_core/src/state.rs#L55
warning: item name ends with its containing module's name
--> mqttrust_core/src/state.rs:55:12
|
55 | pub struct MqttState<const TIMER_HZ: u32> {
| ^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions
|
item in documentation is missing backticks:
mqttrust_core/src/state.rs#L39
warning: item in documentation is missing backticks
--> mqttrust_core/src/state.rs:39:18
|
39 | /// Non-zero QoS publications require PID
| ^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
|
39 | /// Non-zero `QoS` publications require PID
| ~~~~~
|
item name starts with its containing module's name:
mqttrust_core/src/state.rs#L24
warning: item name starts with its containing module's name
--> mqttrust_core/src/state.rs:24:10
|
24 | pub enum StateError {
| ^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions
|
usage of wildcard import:
mqttrust_core/src/state.rs#L11
warning: usage of wildcard import
--> mqttrust_core/src/state.rs:11:5
|
11 | use mqttrust::encoding::v4::*;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `mqttrust::encoding::v4::{Connack, ConnectReturnCode, Packet, PacketType, Pid, Publish, QoS, Suback, decoder}`
|
= 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)]`
|
methods with the following characteristics: (`to_*` and `self` type is not `Copy`) usually take `self` by reference:
mqttrust_core/src/packet.rs#L54
warning: methods with the following characteristics: (`to_*` and `self` type is not `Copy`) usually take `self` by reference
--> mqttrust_core/src/packet.rs:54:21
|
54 | pub fn to_inner(self) -> &'a mut [u8] {
| ^^^^
|
= help: consider choosing a less ambiguous name
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wrong_self_convention
= note: `-W clippy::wrong-self-convention` implied by `-W clippy::all`
= help: to override `-W clippy::all` add `#[allow(clippy::wrong_self_convention)]`
|
this expression creates a reference which is immediately dereferenced by the compiler:
mqttrust_core/src/packet.rs#L50
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> mqttrust_core/src/packet.rs:50:23
|
50 | pid.to_buffer(&mut self.0, &mut offset)
| ^^^^^^^^^^^ help: change this to: `self.0`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
item name ends with its containing module's name:
mqttrust_core/src/packet.rs#L9
warning: item name ends with its containing module's name
--> mqttrust_core/src/packet.rs:9:12
|
9 | pub struct SerializedPacket<'a>(pub &'a mut [u8]);
| ^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions
|
this could be a `const fn`:
mqttrust_core/src/options.rs#L164
warning: this could be a `const fn`
--> mqttrust_core/src/options.rs:164:5
|
164 | / pub fn credentials(&self) -> (Option<&'a str>, Option<&'a [u8]>) {
165 | | if let Some((username, password)) = self.credentials {
166 | | (Some(username), Some(password))
167 | | } else {
168 | | (None, None)
169 | | }
170 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
|
this method could have a `#[must_use]` attribute:
mqttrust_core/src/options.rs#L164
warning: this method could have a `#[must_use]` attribute
--> mqttrust_core/src/options.rs:164:5
|
164 | pub fn credentials(&self) -> (Option<&'a str>, Option<&'a [u8]>) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn credentials(&self) -> (Option<&'a str>, Option<&'a [u8]>)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate
|
missing `#[must_use]` attribute on a method returning `Self`:
mqttrust_core/src/options.rs#L156
warning: missing `#[must_use]` attribute on a method returning `Self`
--> mqttrust_core/src/options.rs:156:5
|
156 | / pub fn set_credentials(self, username: &'a str, password: &'a [u8]) -> Self {
157 | | Self {
158 | | credentials: Some((username, password)),
159 | | ..self
160 | | }
161 | | }
| |_____^
|
= help: consider adding the `#[must_use]` attribute to the method or directly to the `Self` type
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#return_self_not_must_use
|
this could be a `const fn`:
mqttrust_core/src/options.rs#L156
warning: this could be a `const fn`
--> mqttrust_core/src/options.rs:156:5
|
156 | / pub fn set_credentials(self, username: &'a str, password: &'a [u8]) -> Self {
157 | | Self {
158 | | credentials: Some((username, password)),
159 | | ..self
160 | | }
161 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
|
this method could have a `#[must_use]` attribute:
mqttrust_core/src/options.rs#L156
warning: this method could have a `#[must_use]` attribute
--> mqttrust_core/src/options.rs:156:5
|
156 | pub fn set_credentials(self, username: &'a str, password: &'a [u8]) -> Self {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn set_credentials(self, username: &'a str, password: &'a [u8]) -> Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate
|
this could be a `const fn`:
mqttrust_core/src/options.rs#L151
warning: this could be a `const fn`
--> mqttrust_core/src/options.rs:151:5
|
151 | / pub fn clean_session(&self) -> bool {
152 | | self.clean_session
153 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
|
this method could have a `#[must_use]` attribute:
mqttrust_core/src/options.rs#L151
warning: this method could have a `#[must_use]` attribute
--> mqttrust_core/src/options.rs:151:5
|
151 | pub fn clean_session(&self) -> bool {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn clean_session(&self) -> bool`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate
|
missing `#[must_use]` attribute on a method returning `Self`:
mqttrust_core/src/options.rs#L143
warning: missing `#[must_use]` attribute on a method returning `Self`
--> mqttrust_core/src/options.rs:143:5
|
143 | / pub fn set_clean_session(self, clean_session: bool) -> Self {
144 | | Self {
145 | | clean_session,
146 | | ..self
147 | | }
148 | | }
| |_____^
|
= help: consider adding the `#[must_use]` attribute to the method or directly to the `Self` type
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#return_self_not_must_use
|
this could be a `const fn`:
mqttrust_core/src/options.rs#L143
warning: this could be a `const fn`
--> mqttrust_core/src/options.rs:143:5
|
143 | / pub fn set_clean_session(self, clean_session: bool) -> Self {
144 | | Self {
145 | | clean_session,
146 | | ..self
147 | | }
148 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
|
this method could have a `#[must_use]` attribute:
mqttrust_core/src/options.rs#L143
warning: this method could have a `#[must_use]` attribute
--> mqttrust_core/src/options.rs:143:5
|
143 | pub fn set_clean_session(self, clean_session: bool) -> Self {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn set_clean_session(self, clean_session: bool) -> Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate
|
this could be a `const fn`:
mqttrust_core/src/options.rs#L133
warning: this could be a `const fn`
--> mqttrust_core/src/options.rs:133:5
|
133 | / pub fn client_id(&self) -> &'a str {
134 | | self.client_id
135 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
|
this method could have a `#[must_use]` attribute:
mqttrust_core/src/options.rs#L133
warning: this method could have a `#[must_use]` attribute
--> mqttrust_core/src/options.rs:133:5
|
133 | pub fn client_id(&self) -> &'a str {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn client_id(&self) -> &'a str`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate
|
this could be a `const fn`:
mqttrust_core/src/options.rs#L128
warning: this could be a `const fn`
--> mqttrust_core/src/options.rs:128:5
|
128 | / pub fn keep_alive_ms(&self) -> u32 {
129 | | self.keep_alive_ms
130 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
|
this method could have a `#[must_use]` attribute:
mqttrust_core/src/options.rs#L128
warning: this method could have a `#[must_use]` attribute
--> mqttrust_core/src/options.rs:128:5
|
128 | pub fn keep_alive_ms(&self) -> u32 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn keep_alive_ms(&self) -> u32`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate
|
casting `u16` to `u32` may become silently lossy if you later change the type:
mqttrust_core/src/options.rs#L122
warning: casting `u16` to `u32` may become silently lossy if you later change the type
--> mqttrust_core/src/options.rs:122:28
|
122 | keep_alive_ms: secs as u32 * 1000,
| ^^^^^^^^^^^ help: try: `u32::from(secs)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless
|
only a `panic!` in `if`-then statement:
mqttrust_core/src/options.rs#L117
warning: only a `panic!` in `if`-then statement
--> mqttrust_core/src/options.rs:117:9
|
117 | / if secs < 5 {
118 | | panic!("Keep alives should be >= 5 secs");
119 | | }
| |_________^ help: try instead: `assert!(!(secs < 5), "Keep alives should be >= 5 secs");`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_assert
|
missing `#[must_use]` attribute on a method returning `Self`:
mqttrust_core/src/options.rs#L116
warning: missing `#[must_use]` attribute on a method returning `Self`
--> mqttrust_core/src/options.rs:116:5
|
116 | / pub fn set_keep_alive(self, secs: u16) -> Self {
117 | | if secs < 5 {
118 | | panic!("Keep alives should be >= 5 secs");
119 | | }
... |
124 | | }
125 | | }
| |_____^
|
= help: consider adding the `#[must_use]` attribute to the method or directly to the `Self` type
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#return_self_not_must_use
|
this method could have a `#[must_use]` attribute:
mqttrust_core/src/options.rs#L116
warning: this method could have a `#[must_use]` attribute
--> mqttrust_core/src/options.rs:116:5
|
116 | pub fn set_keep_alive(self, secs: u16) -> Self {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn set_keep_alive(self, secs: u16) -> Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate
|
this method could have a `#[must_use]` attribute:
mqttrust_core/src/options.rs#L99
warning: this method could have a `#[must_use]` attribute
--> mqttrust_core/src/options.rs:99:5
|
99 | pub fn last_will(&self) -> Option<LastWill<'a>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn last_will(&self) -> Option<LastWill<'a>>`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate
|
missing `#[must_use]` attribute on a method returning `Self`:
mqttrust_core/src/options.rs#L92
warning: missing `#[must_use]` attribute on a method returning `Self`
--> mqttrust_core/src/options.rs:92:5
|
92 | / pub fn set_last_will(self, will: LastWill<'a>) -> Self {
93 | | Self {
94 | | last_will: Some(will),
95 | | ..self
96 | | }
97 | | }
| |_____^
|
= help: consider adding the `#[must_use]` attribute to the method or directly to the `Self` type
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#return_self_not_must_use
|
this could be a `const fn`:
mqttrust_core/src/options.rs#L92
warning: this could be a `const fn`
--> mqttrust_core/src/options.rs:92:5
|
92 | / pub fn set_last_will(self, will: LastWill<'a>) -> Self {
93 | | Self {
94 | | last_will: Some(will),
95 | | ..self
96 | | }
97 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
|
this method could have a `#[must_use]` attribute:
mqttrust_core/src/options.rs#L92
warning: this method could have a `#[must_use]` attribute
--> mqttrust_core/src/options.rs:92:5
|
92 | pub fn set_last_will(self, will: LastWill<'a>) -> Self {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn set_last_will(self, will: LastWill<'a>) -> Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate
|
missing `#[must_use]` attribute on a method returning `Self`:
mqttrust_core/src/options.rs#L88
warning: missing `#[must_use]` attribute on a method returning `Self`
--> mqttrust_core/src/options.rs:88:5
|
88 | / pub fn set_port(self, port: u16) -> Self {
89 | | Self { port, ..self }
90 | | }
| |_____^
|
= help: consider adding the `#[must_use]` attribute to the method or directly to the `Self` type
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#return_self_not_must_use
|
this could be a `const fn`:
mqttrust_core/src/options.rs#L88
warning: this could be a `const fn`
--> mqttrust_core/src/options.rs:88:5
|
88 | / pub fn set_port(self, port: u16) -> Self {
89 | | Self { port, ..self }
90 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
|
this method could have a `#[must_use]` attribute:
mqttrust_core/src/options.rs#L88
warning: this method could have a `#[must_use]` attribute
--> mqttrust_core/src/options.rs:88:5
|
88 | pub fn set_port(self, port: u16) -> Self {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn set_port(self, port: u16) -> Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate
|
missing `#[must_use]` attribute on a method returning `Self`:
mqttrust_core/src/options.rs#L81
warning: missing `#[must_use]` attribute on a method returning `Self`
--> mqttrust_core/src/options.rs:81:5
|
81 | / pub fn set_broker(self, broker: Broker<'a>) -> Self {
82 | | Self {
83 | | broker_addr: broker,
84 | | ..self
85 | | }
86 | | }
| |_____^
|
= help: consider adding the `#[must_use]` attribute to the method or directly to the `Self` type
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#return_self_not_must_use
= note: `-W clippy::return-self-not-must-use` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::return_self_not_must_use)]`
|
this could be a `const fn`:
mqttrust_core/src/options.rs#L81
warning: this could be a `const fn`
--> mqttrust_core/src/options.rs:81:5
|
81 | / pub fn set_broker(self, broker: Broker<'a>) -> Self {
82 | | Self {
83 | | broker_addr: broker,
84 | | ..self
85 | | }
86 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
|
this method could have a `#[must_use]` attribute:
mqttrust_core/src/options.rs#L81
warning: this method could have a `#[must_use]` attribute
--> mqttrust_core/src/options.rs:81:5
|
81 | pub fn set_broker(self, broker: Broker<'a>) -> Self {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn set_broker(self, broker: Broker<'a>) -> Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate
|
this method could have a `#[must_use]` attribute:
mqttrust_core/src/options.rs#L76
warning: this method could have a `#[must_use]` attribute
--> mqttrust_core/src/options.rs:76:5
|
76 | pub fn broker(&self) -> (Broker, u16) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn broker(&self) -> (Broker, u16)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate
|
only a `panic!` in `if`-then statement:
mqttrust_core/src/options.rs#L58
warning: only a `panic!` in `if`-then statement
--> mqttrust_core/src/options.rs:58:9
|
58 | / if id.starts_with(' ') || id.is_empty() {
59 | | panic!("Invalid client id")
60 | | }
| |_________^ help: try instead: `assert!(!(id.starts_with(' ') || id.is_empty()), "Invalid client id");`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_assert
= note: `-W clippy::manual-assert` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::manual_assert)]`
|
this method could have a `#[must_use]` attribute:
mqttrust_core/src/options.rs#L57
warning: this method could have a `#[must_use]` attribute
--> mqttrust_core/src/options.rs:57:5
|
57 | pub fn new(id: &'a str, broker: Broker<'a>, port: u16) -> MqttOptions<'a> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn new(id: &'a str, broker: Broker<'a>, port: u16) -> MqttOptions<'a>`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate
|
item name ends with its containing module's name:
mqttrust_core/src/options.rs#L34
warning: item name ends with its containing module's name
--> mqttrust_core/src/options.rs:34:12
|
34 | pub struct MqttOptions<'a> {
| ^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions
= note: `-W clippy::module-name-repetitions` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::module_name_repetitions)]`
|
you are deriving `PartialEq` and can implement `Eq`:
mqttrust_core/src/options.rs#L4
warning: you are deriving `PartialEq` and can implement `Eq`
--> mqttrust_core/src/options.rs:4:24
|
4 | #[derive(Clone, Debug, 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
= note: `-W clippy::derive-partial-eq-without-eq` implied by `-W clippy::nursery`
= help: to override `-W clippy::nursery` add `#[allow(clippy::derive_partial_eq_without_eq)]`
|
casting `usize` to `u32` may truncate the value on targets with 64-bit wide pointers:
mqttrust_core/src/eventloop.rs#L547
warning: casting `usize` to `u32` may truncate the value on targets with 64-bit wide pointers
--> mqttrust_core/src/eventloop.rs:547:51
|
547 | acc + 1 + length * 0x80_usize.pow(i as u32)
| ^^^^^^^^
|
= help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_truncation
help: ... or use `try_from` and handle the error accordingly
|
547 | acc + 1 + length * 0x80_usize.pow(u32::try_from(i))
| ~~~~~~~~~~~~~~~~
|
this expression creates a reference which is immediately dereferenced by the compiler:
mqttrust_core/src/eventloop.rs#L420
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> mqttrust_core/src/eventloop.rs:420:54
|
420 | let length = nb::block!(network.send(socket, &pkt)).map_err(|_| {
| ^^^^ help: change this to: `pkt`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this lifetime isn't used in the function definition:
mqttrust_core/src/eventloop.rs#L410
warning: this lifetime isn't used in the function definition
--> mqttrust_core/src/eventloop.rs:410:17
|
410 | pub fn send<'d, N: TcpClientStack<TcpSocket = S> + ?Sized>(
| ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes
|
this expression creates a reference which is immediately dereferenced by the compiler:
mqttrust_core/src/eventloop.rs#L395
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> mqttrust_core/src/eventloop.rs:395:33
|
395 | let size = encode_slice(&pkt, self.tx_buf.as_mut()).map_err(EventError::Encoding)?;
| ^^^^ help: change this to: `pkt`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this lifetime isn't used in the function definition:
mqttrust_core/src/eventloop.rs#L385
warning: this lifetime isn't used in the function definition
--> mqttrust_core/src/eventloop.rs:385:24
|
385 | pub fn send_packet<'d, N: TcpClientStack<TcpSocket = S> + ?Sized>(
| ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes
= note: `-W clippy::extra-unused-lifetimes` implied by `-W clippy::all`
= help: to override `-W clippy::all` add `#[allow(clippy::extra_unused_lifetimes)]`
|
unnecessary structure name repetition:
mqttrust_core/src/eventloop.rs#L375
warning: unnecessary structure name repetition
--> mqttrust_core/src/eventloop.rs:375:40
|
375 | let (_hostname, socket_addr) = NetworkHandle::<S>::lookup_host(network, broker, port)?;
| ^^^^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
= note: `-W clippy::use-self` implied by `-W clippy::nursery`
= help: to override `-W clippy::nursery` add `#[allow(clippy::use_self)]`
|
use Option::map_or instead of an if let/else:
mqttrust_core/src/eventloop.rs#L353
warning: use Option::map_or instead of an if let/else
--> mqttrust_core/src/eventloop.rs:353:9
|
353 | / match self.socket {
354 | | Some(ref socket) => network
355 | | .is_connected(socket)
356 | | .map_err(|_e| NetworkError::SocketClosed),
357 | | None => Err(NetworkError::SocketClosed),
358 | | }
| |_________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_if_let_else
help: try
|
353 ~ self.socket.as_ref().map_or(Err(NetworkError::SocketClosed), |socket| network
354 + .is_connected(socket)
355 + .map_err(|_e| NetworkError::SocketClosed))
|
|
this argument is passed by value, but not consumed in the function body:
mqttrust_core/src/eventloop.rs#L313
warning: this argument is passed by value, but not consumed in the function body
--> mqttrust_core/src/eventloop.rs:313:17
|
313 | broker: Broker,
| ^^^^^^ help: consider taking a reference instead: `&Broker`
|
help: consider marking this type as `Copy`
--> mqttrust_core/src/options.rs:5:1
|
5 | pub enum Broker<'a> {
| ^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_value
= note: `-W clippy::needless-pass-by-value` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::needless_pass_by_value)]`
|
casting `u32` to `u16` may truncate the value:
mqttrust_core/src/eventloop.rs#L246
warning: casting `u32` to `u16` may truncate the value
--> mqttrust_core/src/eventloop.rs:246:33
|
246 | keep_alive: (self.options.keep_alive_ms() / 1000) as u16,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_truncation
= note: `-W clippy::cast-possible-truncation` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::cast_possible_truncation)]`
help: ... or use `try_from` and handle the error accordingly
|
246 | keep_alive: u16::try_from(self.options.keep_alive_ms() / 1000),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
casting `u8` to `u32` may become silently lossy if you later change the type:
mqttrust_core/src/eventloop.rs#L223
warning: casting `u8` to `u32` may become silently lossy if you later change the type
--> mqttrust_core/src/eventloop.rs:223:63
|
223 | let backoff = base_time_ms.saturating_mul(u32::pow(2, self.connect_counter as u32 - 1));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `u32::from(self.connect_counter)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless
= note: `-W clippy::cast-lossless` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::cast_lossless)]`
|
docs for function returning `Result` missing `# Errors` section:
mqttrust_core/src/eventloop.rs#L194
warning: docs for function returning `Result` missing `# Errors` section
--> mqttrust_core/src/eventloop.rs:194:5
|
194 | / pub fn yield_event<N: TcpClientStack<TcpSocket = S> + ?Sized>(
195 | | &mut self,
196 | | network: &mut N,
197 | | ) -> nb::Result<Notification, Infallible> {
| |_____________________________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
|
this expression creates a reference which is immediately dereferenced by the compiler:
mqttrust_core/src/eventloop.rs#L185
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> mqttrust_core/src/eventloop.rs:185:47
|
185 | self.network_handle.send(network, &packet)?;
| ^^^^^^^ help: change this to: `packet`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
explicit `deref_mut` method call:
mqttrust_core/src/eventloop.rs#L133
warning: explicit `deref_mut` method call
--> mqttrust_core/src/eventloop.rs:133:59
|
133 | let mut packet = SerializedPacket(grant.deref_mut());
| ^^^^^^^^^^^^^^^^^ help: try: `&mut *grant`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_deref_methods
|
returning the result of a `let` binding from a block:
mqttrust_core/src/eventloop.rs#L117
warning: returning the result of a `let` binding from a block
--> mqttrust_core/src/eventloop.rs:117:9
|
107 | let qos_space = self.state.outgoing_pub.len() < self.state.outgoing_pub.capacity();
| ----------------------------------------------------------------------------------- unnecessary `let` binding
...
117 | qos_space
| ^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return
= note: `-W clippy::let-and-return` implied by `-W clippy::all`
= help: to override `-W clippy::all` add `#[allow(clippy::let_and_return)]`
help: return the expression directly
|
107 ~
108 |
...
116 | // qos_0 || (self.requests.ready() && qos_space)
117 ~ self.state.outgoing_pub.len() < self.state.outgoing_pub.capacity()
|
|
docs for function returning `Result` missing `# Errors` section:
mqttrust_core/src/eventloop.rs#L56
warning: docs for function returning `Result` missing `# Errors` section
--> mqttrust_core/src/eventloop.rs:56:5
|
56 | / pub fn connect<N: Dns + TcpClientStack<TcpSocket = S> + ?Sized>(
57 | | &mut self,
58 | | network: &mut N,
59 | | ) -> nb::Result<Option<Notification>, EventError> {
| |_____________________________________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
= note: `-W clippy::missing-errors-doc` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::missing_errors_doc)]`
|
explicit `deref_mut` method call:
mqttrust_core/src/client.rs#L68
warning: explicit `deref_mut` method call
--> mqttrust_core/src/client.rs:68:49
|
68 | let len = encode_slice(&packet, grant.deref_mut()).map_err(|_| MqttError::Full)?;
| ^^^^^^^^^^^^^^^^^ help: try: `&mut *grant`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_deref_methods
= note: `-W clippy::explicit-deref-methods` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::explicit_deref_methods)]`
|
this expression creates a reference which is immediately dereferenced by the compiler:
mqttrust_core/src/client.rs#L59
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> mqttrust_core/src/client.rs:59:9
|
59 | &self.client_id
| ^^^^^^^^^^^^^^^ help: change this to: `self.client_id`
|
= 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)]`
|
use Option::map_or instead of an if let/else:
mqttrust_core/src/client.rs#L50
warning: use Option::map_or instead of an if let/else
--> mqttrust_core/src/client.rs:50:9
|
50 | / match self.producer.take() {
51 | | Some(prod) => Some(prod.into_inner()),
52 | | None => None,
53 | | }
| |_________^ help: try: `self.producer.take().map_or(None, |prod| Some(prod.into_inner()))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_if_let_else
= note: `-W clippy::option-if-let-else` implied by `-W clippy::nursery`
= help: to override `-W clippy::nursery` add `#[allow(clippy::option_if_let_else)]`
|
manual implementation of `Option::map`:
mqttrust_core/src/client.rs#L50
warning: manual implementation of `Option::map`
--> mqttrust_core/src/client.rs:50:9
|
50 | / match self.producer.take() {
51 | | Some(prod) => Some(prod.into_inner()),
52 | | None => None,
53 | | }
| |_________^ help: try: `self.producer.take().map(|prod| prod.into_inner())`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_map
= note: `-W clippy::manual-map` implied by `-W clippy::all`
= help: to override `-W clippy::all` add `#[allow(clippy::manual_map)]`
|
this could be a `const fn`:
mqttrust_core/src/client.rs#L39
warning: this could be a `const fn`
--> mqttrust_core/src/client.rs:39:5
|
39 | / pub fn new(producer: FrameProducer<'a, L>, client_id: &'b str) -> Self {
40 | | Self {
41 | | client_id,
42 | | producer: Some(RefCell::new(producer)),
43 | | }
44 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
= note: `-W clippy::missing-const-for-fn` implied by `-W clippy::nursery`
= help: to override `-W clippy::nursery` add `#[allow(clippy::missing_const_for_fn)]`
|
this method could have a `#[must_use]` attribute:
mqttrust_core/src/client.rs#L39
warning: this method could have a `#[must_use]` attribute
--> mqttrust_core/src/client.rs:39:5
|
39 | pub fn new(producer: FrameProducer<'a, L>, client_id: &'b str) -> Self {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn new(producer: FrameProducer<'a, L>, client_id: &'b str) -> Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate
= note: `-W clippy::must-use-candidate` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::must_use_candidate)]`
|
item in documentation is missing backticks:
mqttrust_core/src/client.rs#L30
warning: item in documentation is missing backticks
--> mqttrust_core/src/client.rs:30:50
|
30 | /// Packets are read out from queue only when [Eventloop::yield_event](crate::eventloop::EventLoop::yield_event) is called.
| ^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
|
30 | /// Packets are read out from queue only when [`Eventloop::yield_event`](crate::eventloop::EventLoop::yield_event) is called.
| ~~~~~~~~~~~~~~~~~~~~~~~~
|
item in documentation is missing backticks:
mqttrust_core/src/client.rs#L27
warning: item in documentation is missing backticks
--> mqttrust_core/src/client.rs:27:70
|
27 | /// into MQTT frame plus ~2 bytes (depending on grant length) for [FrameProducer](bbqueue::framed) header.
| ^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
|
27 | /// into MQTT frame plus ~2 bytes (depending on grant length) for [`FrameProducer`](bbqueue::framed) header.
| ~~~~~~~~~~~~~~~
|
item in documentation is missing backticks:
mqttrust_core/src/client.rs#L25
warning: item in documentation is missing backticks
--> mqttrust_core/src/client.rs:25:8
|
25 | /// [FrameProducer](bbqueue::framed) header bytes.
| ^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
= note: `-W clippy::doc-markdown` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::doc_markdown)]`
help: try
|
25 | /// [`FrameProducer`](bbqueue::framed) header bytes.
| ~~~~~~~~~~~~~~~
|
method `into_result` is never used:
mqttrust_core/src/fmt.rs#L226
warning: method `into_result` is never used
--> mqttrust_core/src/fmt.rs:226:8
|
223 | pub trait Try {
| --- method in this trait
...
226 | fn into_result(self) -> Result<Self::Ok, Self::Error>;
| ^^^^^^^^^^^
|
= note: `#[warn(dead_code)]` on by default
|
creating a mutable reference to mutable static is discouraged:
mqttrust_core/src/state.rs#L84
warning: creating a mutable reference to mutable static is discouraged
--> mqttrust_core/src/state.rs:84:41
|
84 | BoxedPublish::grow(unsafe { &mut PUBLISH_MEM });
| ^^^^^^^^^^^^^^^^ mutable reference to mutable static
|
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
= note: this will be a hard error in the 2024 edition
= note: this mutable reference has lifetime `'static`, but if the static gets accessed (read or written) by any other means, or any other reference is created, then any further use of this mutable reference is Undefined Behavior
= note: `#[warn(static_mut_refs)]` on by default
help: use `addr_of_mut!` instead to create a raw pointer
|
84 | BoxedPublish::grow(unsafe { addr_of_mut!(PUBLISH_MEM) });
| ~~~~~~~~~~~~~~~~~~~~~~~~~
|
redundant else block:
mqttrust_core/src/packet.rs#L32
warning: redundant else block
--> mqttrust_core/src/packet.rs:32:24
|
32 | } else {
| ________________________^
33 | | offset += len;
34 | | }
| |_________________^
|
= help: remove the `else` block and move the contents out
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_else
= note: `-W clippy::redundant-else` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::redundant_else)]`
|
this argument is a mutable reference, but not used mutably:
mqttrust/src/encoding/v4/encoder.rs#L112
warning: this argument is a mutable reference, but not used mutably
--> mqttrust/src/encoding/v4/encoder.rs:112:55
|
112 | pub(crate) fn check_remaining(buf: &mut [u8], offset: &mut usize, len: usize) -> Result<(), Error> {
| ^^^^^^^^^^ help: consider changing to: `&usize`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut
|
this argument is a mutable reference, but not used mutably:
mqttrust/src/encoding/v4/encoder.rs#L112
warning: this argument is a mutable reference, but not used mutably
--> mqttrust/src/encoding/v4/encoder.rs:112:36
|
112 | pub(crate) fn check_remaining(buf: &mut [u8], offset: &mut usize, len: usize) -> Result<(), Error> {
| ^^^^^^^^^ help: consider changing to: `&[u8]`
|
= 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)]`
|
docs for function returning `Result` missing `# Errors` section:
mqttrust/src/lib.rs#L46
warning: docs for function returning `Result` missing `# Errors` section
--> mqttrust/src/lib.rs:46:5
|
46 | fn unsubscribe(&self, topics: &[&str]) -> Result<(), MqttError> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
|
docs for function returning `Result` missing `# Errors` section:
mqttrust/src/lib.rs#L41
warning: docs for function returning `Result` missing `# Errors` section
--> mqttrust/src/lib.rs:41:5
|
41 | fn subscribe(&self, topics: &[SubscribeTopic<'_>]) -> Result<(), MqttError> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
|
docs for function returning `Result` missing `# Errors` section:
mqttrust/src/lib.rs#L28
warning: docs for function returning `Result` missing `# Errors` section
--> mqttrust/src/lib.rs:28:5
|
28 | fn publish(&self, topic_name: &str, payload: &[u8], qos: QoS) -> Result<(), MqttError> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
|
docs for function returning `Result` missing `# Errors` section:
mqttrust/src/lib.rs#L24
warning: docs for function returning `Result` missing `# Errors` section
--> mqttrust/src/lib.rs:24:5
|
24 | fn send(&self, packet: Packet<'_>) -> Result<(), MqttError>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
|
item in documentation is missing backticks:
mqttrust/src/lib.rs#L17
warning: item in documentation is missing backticks
--> mqttrust/src/lib.rs:17:9
|
17 | /// RefCell borrow fault
| ^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
|
17 | /// `RefCell` borrow fault
| ~~~~~~~~~
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/utils.rs#L218
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/utils.rs:218:13
|
218 | QosPid::ExactlyOnce(_) => QoS::ExactlyOnce,
| ^^^^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/utils.rs#L217
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/utils.rs:217:13
|
217 | QosPid::AtLeastOnce(_) => QoS::AtLeastOnce,
| ^^^^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/utils.rs#L216
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/utils.rs:216:13
|
216 | QosPid::AtMostOnce => QoS::AtMostOnce,
| ^^^^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
this could be a `const fn`:
mqttrust/src/encoding/v4/utils.rs#L214
warning: this could be a `const fn`
--> mqttrust/src/encoding/v4/utils.rs:214:5
|
214 | / pub fn qos(self) -> QoS {
215 | | match self {
216 | | QosPid::AtMostOnce => QoS::AtMostOnce,
217 | | QosPid::AtLeastOnce(_) => QoS::AtLeastOnce,
218 | | QosPid::ExactlyOnce(_) => QoS::ExactlyOnce,
219 | | }
220 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
|
this method could have a `#[must_use]` attribute:
mqttrust/src/encoding/v4/utils.rs#L214
warning: this method could have a `#[must_use]` attribute
--> mqttrust/src/encoding/v4/utils.rs:214:5
|
214 | pub fn qos(self) -> QoS {
| ^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn qos(self) -> QoS`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/utils.rs#L207
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/utils.rs:207:13
|
207 | QosPid::ExactlyOnce(p) => Some(p),
| ^^^^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/utils.rs#L206
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/utils.rs:206:13
|
206 | QosPid::AtLeastOnce(p) => Some(p),
| ^^^^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/utils.rs#L205
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/utils.rs:205:13
|
205 | QosPid::AtMostOnce => None,
| ^^^^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
this match arm has an identical body to another arm:
mqttrust/src/encoding/v4/utils.rs#L206
warning: this match arm has an identical body to another arm
--> mqttrust/src/encoding/v4/utils.rs:206:13
|
206 | QosPid::AtLeastOnce(p) => Some(p),
| ----------------------^^^^^^^^^^^
| |
| help: try merging the arm patterns: `QosPid::AtLeastOnce(p) | QosPid::ExactlyOnce(p)`
|
= help: or try changing either arm body
note: other arm here
--> mqttrust/src/encoding/v4/utils.rs:207:13
|
207 | QosPid::ExactlyOnce(p) => Some(p),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms
= note: `-W clippy::match-same-arms` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::match_same_arms)]`
|
this could be a `const fn`:
mqttrust/src/encoding/v4/utils.rs#L203
warning: this could be a `const fn`
--> mqttrust/src/encoding/v4/utils.rs:203:5
|
203 | / pub fn pid(self) -> Option<Pid> {
204 | | match self {
205 | | QosPid::AtMostOnce => None,
206 | | QosPid::AtLeastOnce(p) => Some(p),
207 | | QosPid::ExactlyOnce(p) => Some(p),
208 | | }
209 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
|
this method could have a `#[must_use]` attribute:
mqttrust/src/encoding/v4/utils.rs#L203
warning: this method could have a `#[must_use]` attribute
--> mqttrust/src/encoding/v4/utils.rs:203:5
|
203 | pub fn pid(self) -> Option<Pid> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn pid(self) -> Option<Pid>`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/utils.rs#L177
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/utils.rs:177:21
|
177 | 2 => Ok(QoS::ExactlyOnce),
| ^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/utils.rs#L176
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/utils.rs:176:21
|
176 | 1 => Ok(QoS::AtLeastOnce),
| ^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/utils.rs#L175
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/utils.rs:175:21
|
175 | 0 => Ok(QoS::AtMostOnce),
| ^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/utils.rs#L173
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/utils.rs:173:47
|
173 | pub(crate) fn from_u8(byte: u8) -> Result<QoS, Error> {
| ^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
this could be a `const fn`:
mqttrust/src/encoding/v4/utils.rs#L173
warning: this could be a `const fn`
--> mqttrust/src/encoding/v4/utils.rs:173:5
|
173 | / pub(crate) fn from_u8(byte: u8) -> Result<QoS, Error> {
174 | | match byte {
175 | | 0 => Ok(QoS::AtMostOnce),
176 | | 1 => Ok(QoS::AtLeastOnce),
... |
179 | | }
180 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/utils.rs#L169
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/utils.rs:169:13
|
169 | QoS::ExactlyOnce => 2,
| ^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/utils.rs#L168
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/utils.rs:168:13
|
168 | QoS::AtLeastOnce => 1,
| ^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/utils.rs#L167
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/utils.rs:167:13
|
167 | QoS::AtMostOnce => 0,
| ^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
this argument (1 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte):
mqttrust/src/encoding/v4/utils.rs#L165
warning: this argument (1 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
--> mqttrust/src/encoding/v4/utils.rs:165:25
|
165 | pub(crate) fn as_u8(&self) -> u8 {
| ^^^^^ help: consider passing by value instead: `self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref
|
this could be a `const fn`:
mqttrust/src/encoding/v4/utils.rs#L165
warning: this could be a `const fn`
--> mqttrust/src/encoding/v4/utils.rs:165:5
|
165 | / pub(crate) fn as_u8(&self) -> u8 {
166 | | match *self {
167 | | QoS::AtMostOnce => 0,
168 | | QoS::AtLeastOnce => 1,
169 | | QoS::ExactlyOnce => 2,
170 | | }
171 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/utils.rs#L143
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/utils.rs:143:28
|
143 | Some(nz) => Ok(Pid(nz)),
| ^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
use Option::map_or_else instead of an if let/else:
mqttrust/src/encoding/v4/utils.rs#L142
warning: use Option::map_or_else instead of an if let/else
--> mqttrust/src/encoding/v4/utils.rs:142:9
|
142 | / match NonZeroU16::new(u) {
143 | | Some(nz) => Ok(Pid(nz)),
144 | | None => Err(Error::InvalidPid(u)),
145 | | }
| |_________^ help: try: `NonZeroU16::new(u).map_or_else(|| Err(Error::InvalidPid(u)), |nz| Ok(Pid(nz)))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_if_let_else
= note: `-W clippy::option-if-let-else` implied by `-W clippy::nursery`
= help: to override `-W clippy::nursery` add `#[allow(clippy::option_if_let_else)]`
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/utils.rs#L126
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/utils.rs:126:9
|
126 | Pid(NonZeroU16::new(n).unwrap())
| ^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/utils.rs#L120
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/utils.rs:120:29
|
120 | fn sub(self, u: u16) -> Pid {
| ^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/utils.rs#L117
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/utils.rs:117:19
|
117 | type Output = Pid;
| ^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/utils.rs#L112
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/utils.rs:112:9
|
112 | Pid(NonZeroU16::new(n).unwrap())
| ^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/utils.rs#L107
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/utils.rs:107:29
|
107 | fn add(self, u: u16) -> Pid {
| ^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/utils.rs#L104
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/utils.rs:104:19
|
104 | type Output = Pid;
| ^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/utils.rs#L99
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/utils.rs:99:9
|
99 | Pid::new()
| ^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/utils.rs#L98
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/utils.rs:98:21
|
98 | fn default() -> Pid {
| ^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
docs for function returning `Result` missing `# Errors` section:
mqttrust/src/encoding/v4/utils.rs#L92
warning: docs for function returning `Result` missing `# Errors` section
--> mqttrust/src/encoding/v4/utils.rs:92:5
|
92 | pub fn to_buffer(self, buf: &mut [u8], offset: &mut usize) -> Result<(), Error> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
|
casting `u8` to `u16` may become silently lossy if you later change the type:
mqttrust/src/encoding/v4/utils.rs#L87
warning: casting `u8` to `u16` may become silently lossy if you later change the type
--> mqttrust/src/encoding/v4/utils.rs:87:50
|
87 | let pid = ((buf[*offset] as u16) << 8) | buf[*offset + 1] as u16;
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `u16::from(buf[*offset + 1])`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless
|
casting `u8` to `u16` may become silently lossy if you later change the type:
mqttrust/src/encoding/v4/utils.rs#L87
warning: casting `u8` to `u16` may become silently lossy if you later change the type
--> mqttrust/src/encoding/v4/utils.rs:87:20
|
87 | let pid = ((buf[*offset] as u16) << 8) | buf[*offset + 1] as u16;
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `u16::from(buf[*offset])`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless
|
this could be a `const fn`:
mqttrust/src/encoding/v4/utils.rs#L82
warning: this could be a `const fn`
--> mqttrust/src/encoding/v4/utils.rs:82:5
|
82 | / pub fn get(self) -> u16 {
83 | | self.0.get()
84 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
|
this method could have a `#[must_use]` attribute:
mqttrust/src/encoding/v4/utils.rs#L82
warning: this method could have a `#[must_use]` attribute
--> mqttrust/src/encoding/v4/utils.rs:82:5
|
82 | pub fn get(self) -> u16 {
| ^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn get(self) -> u16`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/utils.rs#L78
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/utils.rs:78:9
|
78 | Pid(NonZeroU16::new(1).unwrap())
| ^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
docs for function which may panic missing `# Panics` section:
mqttrust/src/encoding/v4/utils.rs#L77
warning: docs for function which may panic missing `# Panics` section
--> mqttrust/src/encoding/v4/utils.rs:77:5
|
77 | pub fn new() -> Self {
| ^^^^^^^^^^^^^^^^^^^^
|
note: first possible panic found here
--> mqttrust/src/encoding/v4/utils.rs:78:13
|
78 | Pid(NonZeroU16::new(1).unwrap())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
= note: `-W clippy::missing-panics-doc` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::missing_panics_doc)]`
|
this method could have a `#[must_use]` attribute:
mqttrust/src/encoding/v4/utils.rs#L77
warning: this method could have a `#[must_use]` attribute
--> mqttrust/src/encoding/v4/utils.rs:77:5
|
77 | pub fn new() -> Self {
| ^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn new() -> Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate
|
variables can be used directly in the `format!` string:
mqttrust/src/encoding/v4/utils.rs#L39
warning: variables can be used directly in the `format!` string
--> mqttrust/src/encoding/v4/utils.rs:39:9
|
39 | write!(f, "{:?}", self)
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
= note: `-W clippy::uninlined-format-args` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::uninlined_format_args)]`
help: change this to
|
39 - write!(f, "{:?}", self)
39 + write!(f, "{self:?}")
|
|
item in documentation is missing backticks:
mqttrust/src/encoding/v4/utils.rs#L26
warning: item in documentation is missing backticks
--> mqttrust/src/encoding/v4/utils.rs:26:73
|
26 | /// Tried to decode an invalid fixed header (packet type, flags, or remaining_length).
| ^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
|
26 | /// Tried to decode an invalid fixed header (packet type, flags, or `remaining_length`).
| ~~~~~~~~~~~~~~~~~~
|
item in documentation is missing backticks:
mqttrust/src/encoding/v4/utils.rs#L22
warning: item in documentation is missing backticks
--> mqttrust/src/encoding/v4/utils.rs:22:27
|
22 | /// Tried to decode a ConnectReturnCode > 5.
| ^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
|
22 | /// Tried to decode a `ConnectReturnCode` > 5.
| ~~~~~~~~~~~~~~~~~~~
|
item in documentation is missing backticks:
mqttrust/src/encoding/v4/utils.rs#L20
warning: item in documentation is missing backticks
--> mqttrust/src/encoding/v4/utils.rs:20:27
|
20 | /// Tried to decode a QoS > 2.
| ^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
|
20 | /// Tried to decode a `QoS` > 2.
| ~~~~~
|
item in documentation is missing backticks:
mqttrust/src/encoding/v4/subscribe.rs#L259
warning: item in documentation is missing backticks
--> mqttrust/src/encoding/v4/subscribe.rs:259:26
|
259 | /// Length: pid(2) + topic.for_each(2+len)
| ^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
|
259 | /// Length: pid(2) + `topic.for_each(2+len`)
| ~~~~~~~~~~~~~~~~~~~~~~
|
this could be a `const fn`:
mqttrust/src/encoding/v4/subscribe.rs#L241
warning: this could be a `const fn`
--> mqttrust/src/encoding/v4/subscribe.rs:241:5
|
241 | / pub fn pid(&self) -> Option<Pid> {
242 | | self.pid
243 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
|
this method could have a `#[must_use]` attribute:
mqttrust/src/encoding/v4/subscribe.rs#L241
warning: this method could have a `#[must_use]` attribute
--> mqttrust/src/encoding/v4/subscribe.rs:241:5
|
241 | pub fn pid(&self) -> Option<Pid> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn pid(&self) -> Option<Pid>`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate
|
this could be a `const fn`:
mqttrust/src/encoding/v4/subscribe.rs#L230
warning: this could be a `const fn`
--> mqttrust/src/encoding/v4/subscribe.rs:230:5
|
230 | / pub fn new(topics: &'a [&'a str]) -> Self {
231 | | Self {
232 | | pid: None,
233 | | topics: List::Owned(topics),
234 | | }
235 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
|
this method could have a `#[must_use]` attribute:
mqttrust/src/encoding/v4/subscribe.rs#L230
warning: this method could have a `#[must_use]` attribute
--> mqttrust/src/encoding/v4/subscribe.rs:230:5
|
230 | pub fn new(topics: &'a [&'a str]) -> Self {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn new(topics: &'a [&'a str]) -> Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate
|
item in documentation is missing backticks:
mqttrust/src/encoding/v4/subscribe.rs#L200
warning: item in documentation is missing backticks
--> mqttrust/src/encoding/v4/subscribe.rs:200:26
|
200 | /// Length: pid(2) + topic.for_each(2+len + qos(1))
| ^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
|
200 | /// Length: pid(2) + `topic.for_each(2+len` + qos(1))
| ~~~~~~~~~~~~~~~~~~~~~~
|
this could be a `const fn`:
mqttrust/src/encoding/v4/subscribe.rs#L182
warning: this could be a `const fn`
--> mqttrust/src/encoding/v4/subscribe.rs:182:5
|
182 | / pub fn pid(&self) -> Option<Pid> {
183 | | self.pid
184 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
|
this method could have a `#[must_use]` attribute:
mqttrust/src/encoding/v4/subscribe.rs#L182
warning: this method could have a `#[must_use]` attribute
--> mqttrust/src/encoding/v4/subscribe.rs:182:5
|
182 | pub fn pid(&self) -> Option<Pid> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn pid(&self) -> Option<Pid>`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate
|
this could be a `const fn`:
mqttrust/src/encoding/v4/subscribe.rs#L171
warning: this could be a `const fn`
--> mqttrust/src/encoding/v4/subscribe.rs:171:5
|
171 | / pub fn new(topics: &'a [SubscribeTopic<'a>]) -> Self {
172 | | Self {
173 | | pid: None,
174 | | topics: List::Owned(topics),
175 | | }
176 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
|
this method could have a `#[must_use]` attribute:
mqttrust/src/encoding/v4/subscribe.rs#L171
warning: this method could have a `#[must_use]` attribute
--> mqttrust/src/encoding/v4/subscribe.rs:171:5
|
171 | pub fn new(topics: &'a [SubscribeTopic<'a>]) -> Self {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn new(topics: &'a [SubscribeTopic<'a>]) -> Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate
|
you are deriving `PartialEq` and can implement `Eq`:
mqttrust/src/encoding/v4/subscribe.rs#L155
warning: you are deriving `PartialEq` and can implement `Eq`
--> mqttrust/src/encoding/v4/subscribe.rs:155:24
|
155 | #[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
|
you are deriving `PartialEq` and can implement `Eq`:
mqttrust/src/encoding/v4/subscribe.rs#L116
warning: you are deriving `PartialEq` and can implement `Eq`
--> mqttrust/src/encoding/v4/subscribe.rs:116:24
|
116 | #[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
|
`IntoIterator` implemented for a reference type without an `iter` method:
mqttrust/src/encoding/v4/subscribe.rs#L100
warning: `IntoIterator` implemented for a reference type without an `iter` method
--> mqttrust/src/encoding/v4/subscribe.rs:100:1
|
100 | / impl<'a, T> IntoIterator for &'a List<'a, T>
101 | | where
102 | | T: FromBuffer<'a, Item = T> + Clone,
103 | | {
... |
113 | | }
114 | | }
| |_^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_without_iter
= note: `-W clippy::into-iter-without-iter` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::into_iter_without_iter)]`
help: consider implementing `iter`
|
100 +
101 + impl List<'a, T> {
102 + fn iter(&self) -> ListIter<'a, T> {
103 + <&Self as IntoIterator>::into_iter(self)
104 + }
105 + }
|
|
this method could have a `#[must_use]` attribute:
mqttrust/src/encoding/v4/subscribe.rs#L85
warning: this method could have a `#[must_use]` attribute
--> mqttrust/src/encoding/v4/subscribe.rs:85:5
|
85 | pub fn len(&self) -> usize {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn len(&self) -> usize`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate
|
enum `List` has a public `len` method, but no `is_empty` method:
mqttrust/src/encoding/v4/subscribe.rs#L85
warning: enum `List` has a public `len` method, but no `is_empty` method
--> mqttrust/src/encoding/v4/subscribe.rs:85:5
|
85 | pub fn len(&self) -> usize {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_without_is_empty
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/subscribe.rs#L70
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/subscribe.rs:70:13
|
70 | SubscribeReturnCodes::Success(qos) => qos.as_u8(),
| ^^^^^^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/subscribe.rs#L69
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/subscribe.rs:69:13
|
69 | SubscribeReturnCodes::Failure => 0x80,
| ^^^^^^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
this argument (1 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte):
mqttrust/src/encoding/v4/subscribe.rs#L67
warning: this argument (1 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
--> mqttrust/src/encoding/v4/subscribe.rs:67:25
|
67 | pub(crate) fn as_u8(&self) -> u8 {
| ^^^^^ help: consider passing by value instead: `self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/subscribe.rs#L61
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/subscribe.rs:61:16
|
61 | Ok(SubscribeReturnCodes::Success(QoS::from_u8(code)?))
| ^^^^^^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/subscribe.rs#L59
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/subscribe.rs:59:16
|
59 | Ok(SubscribeReturnCodes::Failure)
| ^^^^^^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
item name starts with its containing module's name:
mqttrust/src/encoding/v4/subscribe.rs#L46
warning: item name starts with its containing module's name
--> mqttrust/src/encoding/v4/subscribe.rs:46:10
|
46 | pub enum SubscribeReturnCodes {
| ^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions
|
docs for function returning `Result` missing `# Errors` section:
mqttrust/src/encoding/v4/subscribe.rs#L37
warning: docs for function returning `Result` missing `# Errors` section
--> mqttrust/src/encoding/v4/subscribe.rs:37:5
|
37 | fn from_buffer(buf: &'a [u8], offset: &mut usize) -> Result<Self::Item, Error>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
|
you are deriving `PartialEq` and can implement `Eq`:
mqttrust/src/encoding/v4/subscribe.rs#L10
warning: you are deriving `PartialEq` and can implement `Eq`
--> mqttrust/src/encoding/v4/subscribe.rs:10:24
|
10 | #[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
|
item name starts with its containing module's name:
mqttrust/src/encoding/v4/subscribe.rs#L11
warning: item name starts with its containing module's name
--> mqttrust/src/encoding/v4/subscribe.rs:11:12
|
11 | pub struct SubscribeTopic<'a> {
| ^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions
|
usage of wildcard import:
mqttrust/src/encoding/v4/subscribe.rs#L3
warning: usage of wildcard import
--> mqttrust/src/encoding/v4/subscribe.rs:3:37
|
3 | use super::{decoder::*, encoder::*, *};
| ^ help: try: `Error, Pid, QoS`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wildcard_imports
|
usage of wildcard import:
mqttrust/src/encoding/v4/subscribe.rs#L3
warning: usage of wildcard import
--> mqttrust/src/encoding/v4/subscribe.rs:3:25
|
3 | use super::{decoder::*, encoder::*, *};
| ^^^^^^^^^^ help: try: `encoder::{check_remaining, write_length, write_string, write_u8}`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wildcard_imports
|
usage of wildcard import:
mqttrust/src/encoding/v4/subscribe.rs#L3
warning: usage of wildcard import
--> mqttrust/src/encoding/v4/subscribe.rs:3:13
|
3 | use super::{decoder::*, encoder::*, *};
| ^^^^^^^^^^ help: try: `decoder::read_str`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wildcard_imports
|
this could be a `const fn`:
mqttrust/src/encoding/v4/publish.rs#L42
warning: this could be a `const fn`
--> mqttrust/src/encoding/v4/publish.rs:42:5
|
42 | / pub(crate) fn len(&self) -> usize {
43 | | // Length: topic (2+len) + pid (0/2) + payload (len)
44 | | 2 + self.topic_name.len()
45 | | + match self.qos {
... |
49 | | + self.payload.len()
50 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
|
this argument (4 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte):
mqttrust/src/encoding/v4/publish.rs#L18
warning: this argument (4 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
--> mqttrust/src/encoding/v4/publish.rs:18:17
|
18 | header: &Header,
| ^^^^^^^ help: consider passing by value instead: `Header`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref
|
you are deriving `PartialEq` and can implement `Eq`:
mqttrust/src/encoding/v4/publish.rs#L6
warning: you are deriving `PartialEq` and can implement `Eq`
--> mqttrust/src/encoding/v4/publish.rs:6:24
|
6 | #[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
|
usage of wildcard import:
mqttrust/src/encoding/v4/publish.rs#L1
warning: usage of wildcard import
--> mqttrust/src/encoding/v4/publish.rs:1:37
|
1 | use super::{decoder::*, encoder::*, *};
| ^ help: try: `Error, Pid, QoS`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wildcard_imports
|
usage of wildcard import:
mqttrust/src/encoding/v4/publish.rs#L1
warning: usage of wildcard import
--> mqttrust/src/encoding/v4/publish.rs:1:25
|
1 | use super::{decoder::*, encoder::*, *};
| ^^^^^^^^^^ help: try: `encoder::{check_remaining, write_length, write_string, write_u16, write_u8}`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wildcard_imports
|
usage of wildcard import:
mqttrust/src/encoding/v4/publish.rs#L1
warning: usage of wildcard import
--> mqttrust/src/encoding/v4/publish.rs:1:13
|
1 | use super::{decoder::*, encoder::*, *};
| ^^^^^^^^^^ help: try: `decoder::{Header, read_str}`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wildcard_imports
|
item name starts with its containing module's name:
mqttrust/src/encoding/v4/packet.rs#L137
warning: item name starts with its containing module's name
--> mqttrust/src/encoding/v4/packet.rs:137:10
|
137 | pub enum PacketType {
| ^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions
|
this method could have a `#[must_use]` attribute:
mqttrust/src/encoding/v4/packet.rs#L88
warning: this method could have a `#[must_use]` attribute
--> mqttrust/src/encoding/v4/packet.rs:88:5
|
88 | pub fn len(&self) -> usize {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn len(&self) -> usize`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate
|
enum `Packet` has a public `len` method, but no `is_empty` method:
mqttrust/src/encoding/v4/packet.rs#L88
warning: enum `Packet` has a public `len` method, but no `is_empty` method
--> mqttrust/src/encoding/v4/packet.rs:88:5
|
88 | pub fn len(&self) -> usize {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_without_is_empty
= note: `-W clippy::len-without-is-empty` implied by `-W clippy::all`
= help: to override `-W clippy::all` add `#[allow(clippy::len_without_is_empty)]`
|
this could be a `const fn`:
mqttrust/src/encoding/v4/packet.rs#L69
warning: this could be a `const fn`
--> mqttrust/src/encoding/v4/packet.rs:69:5
|
69 | / pub fn get_type(&self) -> PacketType {
70 | | match self {
71 | | Packet::Connect(_) => PacketType::Connect,
72 | | Packet::Connack(_) => PacketType::Connack,
... |
85 | | }
86 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
|
this method could have a `#[must_use]` attribute:
mqttrust/src/encoding/v4/packet.rs#L69
warning: this method could have a `#[must_use]` attribute
--> mqttrust/src/encoding/v4/packet.rs:69:5
|
69 | pub fn get_type(&self) -> PacketType {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn get_type(&self) -> PacketType`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate
= note: `-W clippy::must-use-candidate` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::must_use_candidate)]`
|
you should put bare URLs between `<`/`>` or make a proper Markdown link:
mqttrust/src/encoding/v4/packet.rs#L3
warning: you should put bare URLs between `<`/`>` or make a proper Markdown link
--> mqttrust/src/encoding/v4/packet.rs:3:5
|
3 | /// https://docs.solace.com/MQTT-311-Prtl-Conformance-Spec/MQTT%20Control%20Packets.htm#_Toc430864901
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
|
usage of wildcard import:
mqttrust/src/encoding/v4/packet.rs#L1
warning: usage of wildcard import
--> mqttrust/src/encoding/v4/packet.rs:1:5
|
1 | use super::*;
| ^^^^^^^^ help: try: `super::{Connack, Connect, Pid, Publish, Suback, Subscribe, Unsubscribe}`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wildcard_imports
|
casting `usize` to `u16` may truncate the value:
mqttrust/src/encoding/v4/encoder.rs#L167
warning: casting `usize` to `u16` may truncate the value
--> mqttrust/src/encoding/v4/encoder.rs:167:28
|
167 | write_u16(buf, offset, bytes.len() as u16)?;
| ^^^^^^^^^^^^^^^^^^
|
= help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_truncation
help: ... or use `try_from` and handle the error accordingly
|
167 | write_u16(buf, offset, u16::try_from(bytes.len()))?;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
this function's return value is unnecessary:
mqttrust/src/encoding/v4/encoder.rs#L155
warning: this function's return value is unnecessary
--> mqttrust/src/encoding/v4/encoder.rs:155:1
|
155 | / pub(crate) fn write_u8(buf: &mut [u8], offset: &mut usize, val: u8) -> Result<(), Error> {
156 | | buf[*offset] = val;
157 | | *offset += 1;
158 | | Ok(())
159 | | }
| |_^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_wraps
= note: `-W clippy::unnecessary-wraps` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::unnecessary_wraps)]`
help: remove the return type...
|
155 | pub(crate) fn write_u8(buf: &mut [u8], offset: &mut usize, val: u8) -> Result<(), Error> {
| ~~~~~~~~~~~~~~~~~
help: ...and then remove returned values
|
158 - Ok(())
158 +
|
|
casting `usize` to `u8` may truncate the value:
mqttrust/src/encoding/v4/encoder.rs#L144
warning: casting `usize` to `u8` may truncate the value
--> mqttrust/src/encoding/v4/encoder.rs:144:24
|
144 | let mut byte = (x % 128) as u8;
| ^^^^^^^^^^^^^^^
|
= help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_truncation
= note: `-W clippy::cast-possible-truncation` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::cast_possible_truncation)]`
help: ... or use `try_from` and handle the error accordingly
|
144 | let mut byte = u8::try_from(x % 128);
| ~~~~~~~~~~~~~~~~~~~~~
|
you should put bare URLs between `<`/`>` or make a proper Markdown link:
mqttrust/src/encoding/v4/encoder.rs#L120
warning: you should put bare URLs between `<`/`>` or make a proper Markdown link
--> mqttrust/src/encoding/v4/encoder.rs:120:5
|
120 | /// http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718023
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
|
item in documentation is missing backticks:
mqttrust/src/encoding/v4/encoder.rs#L111
warning: item in documentation is missing backticks
--> mqttrust/src/encoding/v4/encoder.rs:111:5
|
111 | /// Result::Err instead of panicking.
| ^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
|
111 | /// `Result::Err` instead of panicking.
| ~~~~~~~~~~~~~
|
docs for function returning `Result` missing `# Errors` section:
mqttrust/src/encoding/v4/encoder.rs#L28
warning: docs for function returning `Result` missing `# Errors` section
--> mqttrust/src/encoding/v4/encoder.rs:28:1
|
28 | pub fn encode_slice(packet: &Packet, buf: &mut [u8]) -> Result<usize, Error> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/decoder.rs#L95
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/decoder.rs:95:12
|
95 | Ok(Header {
| ^^^^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
bit mask could be simplified with a call to `trailing_zeros`:
mqttrust/src/encoding/v4/decoder.rs#L89
warning: bit mask could be simplified with a call to `trailing_zeros`
--> mqttrust/src/encoding/v4/decoder.rs:89:44
|
89 | 14 => (PacketType::Disconnect, hd & 0b1111 == 0),
| ^^^^^^^^^^^^^^^^ help: try: `hd.trailing_zeros() >= 4`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#verbose_bit_mask
|
bit mask could be simplified with a call to `trailing_zeros`:
mqttrust/src/encoding/v4/decoder.rs#L88
warning: bit mask could be simplified with a call to `trailing_zeros`
--> mqttrust/src/encoding/v4/decoder.rs:88:42
|
88 | 13 => (PacketType::Pingresp, hd & 0b1111 == 0),
| ^^^^^^^^^^^^^^^^ help: try: `hd.trailing_zeros() >= 4`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#verbose_bit_mask
|
bit mask could be simplified with a call to `trailing_zeros`:
mqttrust/src/encoding/v4/decoder.rs#L87
warning: bit mask could be simplified with a call to `trailing_zeros`
--> mqttrust/src/encoding/v4/decoder.rs:87:41
|
87 | 12 => (PacketType::Pingreq, hd & 0b1111 == 0),
| ^^^^^^^^^^^^^^^^ help: try: `hd.trailing_zeros() >= 4`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#verbose_bit_mask
|
bit mask could be simplified with a call to `trailing_zeros`:
mqttrust/src/encoding/v4/decoder.rs#L86
warning: bit mask could be simplified with a call to `trailing_zeros`
--> mqttrust/src/encoding/v4/decoder.rs:86:42
|
86 | 11 => (PacketType::Unsuback, hd & 0b1111 == 0),
| ^^^^^^^^^^^^^^^^ help: try: `hd.trailing_zeros() >= 4`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#verbose_bit_mask
|
bit mask could be simplified with a call to `trailing_zeros`:
mqttrust/src/encoding/v4/decoder.rs#L84
warning: bit mask could be simplified with a call to `trailing_zeros`
--> mqttrust/src/encoding/v4/decoder.rs:84:39
|
84 | 9 => (PacketType::Suback, hd & 0b1111 == 0),
| ^^^^^^^^^^^^^^^^ help: try: `hd.trailing_zeros() >= 4`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#verbose_bit_mask
|
bit mask could be simplified with a call to `trailing_zeros`:
mqttrust/src/encoding/v4/decoder.rs#L82
warning: bit mask could be simplified with a call to `trailing_zeros`
--> mqttrust/src/encoding/v4/decoder.rs:82:40
|
82 | 7 => (PacketType::Pubcomp, hd & 0b1111 == 0),
| ^^^^^^^^^^^^^^^^ help: try: `hd.trailing_zeros() >= 4`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#verbose_bit_mask
|
bit mask could be simplified with a call to `trailing_zeros`:
mqttrust/src/encoding/v4/decoder.rs#L80
warning: bit mask could be simplified with a call to `trailing_zeros`
--> mqttrust/src/encoding/v4/decoder.rs:80:39
|
80 | 5 => (PacketType::Pubrec, hd & 0b1111 == 0),
| ^^^^^^^^^^^^^^^^ help: try: `hd.trailing_zeros() >= 4`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#verbose_bit_mask
|
bit mask could be simplified with a call to `trailing_zeros`:
mqttrust/src/encoding/v4/decoder.rs#L79
warning: bit mask could be simplified with a call to `trailing_zeros`
--> mqttrust/src/encoding/v4/decoder.rs:79:39
|
79 | 4 => (PacketType::Puback, hd & 0b1111 == 0),
| ^^^^^^^^^^^^^^^^ help: try: `hd.trailing_zeros() >= 4`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#verbose_bit_mask
|
bit mask could be simplified with a call to `trailing_zeros`:
mqttrust/src/encoding/v4/decoder.rs#L77
warning: bit mask could be simplified with a call to `trailing_zeros`
--> mqttrust/src/encoding/v4/decoder.rs:77:40
|
77 | 2 => (PacketType::Connack, hd & 0b1111 == 0),
| ^^^^^^^^^^^^^^^^ help: try: `hd.trailing_zeros() >= 4`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#verbose_bit_mask
|
bit mask could be simplified with a call to `trailing_zeros`:
mqttrust/src/encoding/v4/decoder.rs#L76
warning: bit mask could be simplified with a call to `trailing_zeros`
--> mqttrust/src/encoding/v4/decoder.rs:76:40
|
76 | 1 => (PacketType::Connect, hd & 0b1111 == 0),
| ^^^^^^^^^^^^^^^^ help: try: `hd.trailing_zeros() >= 4`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#verbose_bit_mask
= note: `-W clippy::verbose-bit-mask` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::verbose_bit_mask)]`
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/decoder.rs#L74
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/decoder.rs:74:34
|
74 | pub fn new(hd: u8) -> Result<Header, Error> {
| ^^^^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
docs for function returning `Result` missing `# Errors` section:
mqttrust/src/encoding/v4/decoder.rs#L74
warning: docs for function returning `Result` missing `# Errors` section
--> mqttrust/src/encoding/v4/decoder.rs:74:5
|
74 | pub fn new(hd: u8) -> Result<Header, Error> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
|
docs for function returning `Result` missing `# Errors` section:
mqttrust/src/encoding/v4/decoder.rs#L40
warning: docs for function returning `Result` missing `# Errors` section
--> mqttrust/src/encoding/v4/decoder.rs:40:1
|
40 | pub fn read_header(buf: &[u8], offset: &mut usize) -> Result<Option<(Header, usize)>, Error> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
|
item in documentation is missing backticks:
mqttrust/src/encoding/v4/decoder.rs#L38
warning: item in documentation is missing backticks
--> mqttrust/src/encoding/v4/decoder.rs:38:75
|
38 | /// Read the parsed header and remaining_len from the buffer. Only return Some() and advance the
| ^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
|
38 | /// Read the parsed header and remaining_len from the buffer. Only return `Some()` and advance the
| ~~~~~~~~
|
item in documentation is missing backticks:
mqttrust/src/encoding/v4/decoder.rs#L38
warning: item in documentation is missing backticks
--> mqttrust/src/encoding/v4/decoder.rs:38:32
|
38 | /// Read the parsed header and remaining_len from the buffer. Only return Some() and advance the
| ^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
|
38 | /// Read the parsed header and `remaining_len` from the buffer. Only return Some() and advance the
| ~~~~~~~~~~~~~~~
|
docs for function returning `Result` missing `# Errors` section:
mqttrust/src/encoding/v4/decoder.rs#L3
warning: docs for function returning `Result` missing `# Errors` section
--> mqttrust/src/encoding/v4/decoder.rs:3:1
|
3 | pub fn decode_slice(buf: &[u8]) -> Result<Option<Packet<'_>>, Error> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
= note: `-W clippy::missing-errors-doc` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::missing_errors_doc)]`
|
usage of wildcard import:
mqttrust/src/encoding/v4/decoder.rs#L1
warning: usage of wildcard import
--> mqttrust/src/encoding/v4/decoder.rs:1:5
|
1 | use super::*;
| ^^^^^^^^ help: try: `super::{Connack, Connect, Error, Packet, PacketType, Pid, Publish, QoS, Suback, Subscribe, Unsubscribe}`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wildcard_imports
|
this argument (2 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte):
mqttrust/src/encoding/v4/connect.rs#L259
warning: this argument (2 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
--> mqttrust/src/encoding/v4/connect.rs:259:29
|
259 | pub(crate) fn to_buffer(&self, buf: &mut [u8], offset: &mut usize) -> Result<usize, Error> {
| ^^^^^ help: consider passing by value instead: `self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref
|
methods with the following characteristics: (`to_*` and `self` type is `Copy`) usually take `self` by value:
mqttrust/src/encoding/v4/connect.rs#L259
warning: methods with the following characteristics: (`to_*` and `self` type is `Copy`) usually take `self` by value
--> mqttrust/src/encoding/v4/connect.rs:259:29
|
259 | pub(crate) fn to_buffer(&self, buf: &mut [u8], offset: &mut usize) -> Result<usize, Error> {
| ^^^^^
|
= help: consider choosing a less ambiguous name
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wrong_self_convention
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/connect.rs#L254
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/connect.rs:254:12
|
254 | Ok(Connack {
| ^^^^^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
this expression creates a reference which is immediately dereferenced by the compiler:
mqttrust/src/encoding/v4/connect.rs#L235
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> mqttrust/src/encoding/v4/connect.rs:235:38
|
235 | write_bytes(buf, offset, &last_will.message)?;
| ^^^^^^^^^^^^^^^^^^ help: change this to: `last_will.message`
|
= 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)]`
|
this could be a `const fn`:
mqttrust/src/encoding/v4/connect.rs#L180
warning: this could be a `const fn`
--> mqttrust/src/encoding/v4/connect.rs:180:5
|
180 | / pub(crate) fn len(&self) -> usize {
181 | | let mut length: usize = 6 + 1 + 1; // NOTE: protocol_name(6) + protocol_level(1) + flags(1);
182 | | length += 2 + self.client_id.len();
183 | | length += 2; // keep alive
... |
197 | | length
198 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
|
casting `u8` to `u16` may become silently lossy if you later change the type:
mqttrust/src/encoding/v4/connect.rs#L136
warning: casting `u8` to `u16` may become silently lossy if you later change the type
--> mqttrust/src/encoding/v4/connect.rs:136:61
|
136 | let keep_alive = ((buf[*offset + 1] as u16) << 8) | buf[*offset + 2] as u16;
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `u16::from(buf[*offset + 2])`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless
|
casting `u8` to `u16` may become silently lossy if you later change the type:
mqttrust/src/encoding/v4/connect.rs#L136
warning: casting `u8` to `u16` may become silently lossy if you later change the type
--> mqttrust/src/encoding/v4/connect.rs:136:27
|
136 | let keep_alive = ((buf[*offset + 1] as u16) << 8) | buf[*offset + 2] as u16;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `u16::from(buf[*offset + 1])`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless
= note: `-W clippy::cast-lossless` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::cast_lossless)]`
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/connect.rs#L102
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/connect.rs:102:21
|
102 | 5 => Ok(ConnectReturnCode::NotAuthorized),
| ^^^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/connect.rs#L101
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/connect.rs:101:21
|
101 | 4 => Ok(ConnectReturnCode::BadUsernamePassword),
| ^^^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/connect.rs#L100
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/connect.rs:100:21
|
100 | 3 => Ok(ConnectReturnCode::ServerUnavailable),
| ^^^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/connect.rs#L99
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/connect.rs:99:21
|
99 | 2 => Ok(ConnectReturnCode::RefusedIdentifierRejected),
| ^^^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/connect.rs#L98
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/connect.rs:98:21
|
98 | 1 => Ok(ConnectReturnCode::RefusedProtocolVersion),
| ^^^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/connect.rs#L97
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/connect.rs:97:21
|
97 | 0 => Ok(ConnectReturnCode::Accepted),
| ^^^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/connect.rs#L95
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/connect.rs:95:47
|
95 | pub(crate) fn from_u8(byte: u8) -> Result<ConnectReturnCode, Error> {
| ^^^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
this could be a `const fn`:
mqttrust/src/encoding/v4/connect.rs#L95
warning: this could be a `const fn`
--> mqttrust/src/encoding/v4/connect.rs:95:5
|
95 | / pub(crate) fn from_u8(byte: u8) -> Result<ConnectReturnCode, Error> {
96 | | match byte {
97 | | 0 => Ok(ConnectReturnCode::Accepted),
98 | | 1 => Ok(ConnectReturnCode::RefusedProtocolVersion),
... |
104 | | }
105 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/connect.rs#L92
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/connect.rs:92:13
|
92 | ConnectReturnCode::NotAuthorized => 5,
| ^^^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/connect.rs#L91
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/connect.rs:91:13
|
91 | ConnectReturnCode::BadUsernamePassword => 4,
| ^^^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/connect.rs#L90
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/connect.rs:90:13
|
90 | ConnectReturnCode::ServerUnavailable => 3,
| ^^^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/connect.rs#L89
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/connect.rs:89:13
|
89 | ConnectReturnCode::RefusedIdentifierRejected => 2,
| ^^^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/connect.rs#L88
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/connect.rs:88:13
|
88 | ConnectReturnCode::RefusedProtocolVersion => 1,
| ^^^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/connect.rs#L87
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/connect.rs:87:13
|
87 | ConnectReturnCode::Accepted => 0,
| ^^^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
this argument (1 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte):
mqttrust/src/encoding/v4/connect.rs#L85
warning: this argument (1 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
--> mqttrust/src/encoding/v4/connect.rs:85:14
|
85 | fn as_u8(&self) -> u8 {
| ^^^^^ help: consider passing by value instead: `self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref
|
this could be a `const fn`:
mqttrust/src/encoding/v4/connect.rs#L85
warning: this could be a `const fn`
--> mqttrust/src/encoding/v4/connect.rs:85:5
|
85 | / fn as_u8(&self) -> u8 {
86 | | match *self {
87 | | ConnectReturnCode::Accepted => 0,
88 | | ConnectReturnCode::RefusedProtocolVersion => 1,
... |
93 | | }
94 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
= note: `-W clippy::missing-const-for-fn` implied by `-W clippy::nursery`
= help: to override `-W clippy::nursery` add `#[allow(clippy::missing_const_for_fn)]`
|
you are deriving `PartialEq` and can implement `Eq`:
mqttrust/src/encoding/v4/connect.rs#L74
warning: you are deriving `PartialEq` and can implement `Eq`
--> mqttrust/src/encoding/v4/connect.rs:74:30
|
74 | #[derive(Debug, Clone, Copy, 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
|
item name starts with its containing module's name:
mqttrust/src/encoding/v4/connect.rs#L76
warning: item name starts with its containing module's name
--> mqttrust/src/encoding/v4/connect.rs:76:10
|
76 | pub enum ConnectReturnCode {
| ^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions
= note: `-W clippy::module-name-repetitions` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::module_name_repetitions)]`
|
you are deriving `PartialEq` and can implement `Eq`:
mqttrust/src/encoding/v4/connect.rs#L60
warning: you are deriving `PartialEq` and can implement `Eq`
--> mqttrust/src/encoding/v4/connect.rs:60:24
|
60 | #[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
= note: `-W clippy::derive-partial-eq-without-eq` implied by `-W clippy::nursery`
= help: to override `-W clippy::nursery` add `#[allow(clippy::derive_partial_eq_without_eq)]`
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/connect.rs#L43
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/connect.rs:43:13
|
43 | Protocol::MQIsdp => {
| ^^^^^^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/connect.rs#L36
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/connect.rs:36:13
|
36 | Protocol::MQTT311 => {
| ^^^^^^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
this argument (1 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte):
mqttrust/src/encoding/v4/connect.rs#L34
warning: this argument (1 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
--> mqttrust/src/encoding/v4/connect.rs:34:29
|
34 | pub(crate) fn to_buffer(&self, buf: &mut [u8], offset: &mut usize) -> Result<usize, Error> {
| ^^^^^ help: consider passing by value instead: `self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref
= note: `-W clippy::trivially-copy-pass-by-ref` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::trivially_copy_pass_by_ref)]`
|
methods with the following characteristics: (`to_*` and `self` type is `Copy`) usually take `self` by value:
mqttrust/src/encoding/v4/connect.rs#L34
warning: methods with the following characteristics: (`to_*` and `self` type is `Copy`) usually take `self` by value
--> mqttrust/src/encoding/v4/connect.rs:34:29
|
34 | pub(crate) fn to_buffer(&self, buf: &mut [u8], offset: &mut usize) -> Result<usize, Error> {
| ^^^^^
|
= help: consider choosing a less ambiguous name
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wrong_self_convention
= note: `-W clippy::wrong-self-convention` implied by `-W clippy::all`
= help: to override `-W clippy::all` add `#[allow(clippy::wrong_self_convention)]`
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/connect.rs#L32
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/connect.rs:32:9
|
32 | Protocol::new(protocol_name, protocol_level)
| ^^^^^^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/connect.rs#L23
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/connect.rs:23:31
|
23 | ("MQTT", 4) => Ok(Protocol::MQTT311),
| ^^^^^^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/connect.rs#L22
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/connect.rs:22:33
|
22 | ("MQIsdp", 3) => Ok(Protocol::MQIsdp),
| ^^^^^^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
|
unnecessary structure name repetition:
mqttrust/src/encoding/v4/connect.rs#L20
warning: unnecessary structure name repetition
--> mqttrust/src/encoding/v4/connect.rs:20:56
|
20 | pub(crate) fn new(name: &str, level: u8) -> Result<Protocol, Error> {
| ^^^^^^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
= note: `-W clippy::use-self` implied by `-W clippy::nursery`
= help: to override `-W clippy::nursery` add `#[allow(clippy::use_self)]`
|
item in documentation is missing backticks:
mqttrust/src/encoding/v4/connect.rs#L15
warning: item in documentation is missing backticks
--> mqttrust/src/encoding/v4/connect.rs:15:9
|
15 | /// MQIsdp, aka SCADA are pre-standardisation names of MQTT. It should mostly conform to MQTT
| ^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
= note: `-W clippy::doc-markdown` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::doc_markdown)]`
help: try
|
15 | /// `MQIsdp`, aka SCADA are pre-standardisation names of MQTT. It should mostly conform to MQTT
| ~~~~~~~~
|
usage of wildcard import:
mqttrust/src/encoding/v4/connect.rs#L1
warning: usage of wildcard import
--> mqttrust/src/encoding/v4/connect.rs:1:37
|
1 | use super::{decoder::*, encoder::*, *};
| ^ help: try: `Error, QoS`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wildcard_imports
|
usage of wildcard import:
mqttrust/src/encoding/v4/connect.rs#L1
warning: usage of wildcard import
--> mqttrust/src/encoding/v4/connect.rs:1:25
|
1 | use super::{decoder::*, encoder::*, *};
| ^^^^^^^^^^ help: try: `encoder::{check_remaining, write_bytes, write_length, write_string, write_u16, write_u8}`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wildcard_imports
|
usage of wildcard import:
mqttrust/src/encoding/v4/connect.rs#L1
warning: usage of wildcard import
--> mqttrust/src/encoding/v4/connect.rs:1:13
|
1 | use super::{decoder::*, encoder::*, *};
| ^^^^^^^^^^ help: try: `decoder::{read_bytes, read_str}`
|
= 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)]`
|
method `into_result` is never used:
mqttrust/src/fmt.rs#L226
warning: method `into_result` is never used
--> mqttrust/src/fmt.rs:226:8
|
223 | pub trait Try {
| --- method in this trait
...
226 | fn into_result(self) -> Result<Self::Ok, Self::Error>;
| ^^^^^^^^^^^
|
= note: `#[warn(dead_code)]` on by default
|
long literal lacking separators:
mqttrust/src/encoding/v4/subscribe.rs#L308
warning: long literal lacking separators
--> mqttrust/src/encoding/v4/subscribe.rs:308:26
|
308 | let header: u8 = 0b10010000;
| ^^^^^^^^^^ help: consider: `0b1001_0000`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unreadable_literal
|
long literal lacking separators:
mqttrust/src/encoding/v4/subscribe.rs#L269
warning: long literal lacking separators
--> mqttrust/src/encoding/v4/subscribe.rs:269:26
|
269 | let header: u8 = 0b10100010;
| ^^^^^^^^^^ help: consider: `0b1010_0010`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unreadable_literal
|
long literal lacking separators:
mqttrust/src/encoding/v4/subscribe.rs#L210
warning: long literal lacking separators
--> mqttrust/src/encoding/v4/subscribe.rs:210:26
|
210 | let header: u8 = 0b10000010;
| ^^^^^^^^^^ help: consider: `0b1000_0010`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unreadable_literal
|
long literal lacking separators:
mqttrust/src/encoding/v4/publish.rs#L63
warning: long literal lacking separators
--> mqttrust/src/encoding/v4/publish.rs:63:23
|
63 | header |= 0b00000001_u8;
| ^^^^^^^^^^^^^ help: consider: `0b0000_0001_u8`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unreadable_literal
|
long literal lacking separators:
mqttrust/src/encoding/v4/publish.rs#L60
warning: long literal lacking separators
--> mqttrust/src/encoding/v4/publish.rs:60:23
|
60 | header |= 0b00001000_u8;
| ^^^^^^^^^^^^^ help: consider: `0b0000_1000_u8`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unreadable_literal
|
long literal lacking separators:
mqttrust/src/encoding/v4/publish.rs#L57
warning: long literal lacking separators
--> mqttrust/src/encoding/v4/publish.rs:57:33
|
57 | QoS::ExactlyOnce => 0b00110100,
| ^^^^^^^^^^ help: consider: `0b0011_0100`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unreadable_literal
|
long literal lacking separators:
mqttrust/src/encoding/v4/publish.rs#L56
warning: long literal lacking separators
--> mqttrust/src/encoding/v4/publish.rs:56:33
|
56 | QoS::AtLeastOnce => 0b00110010,
| ^^^^^^^^^^ help: consider: `0b0011_0010`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unreadable_literal
|
long literal lacking separators:
mqttrust/src/encoding/v4/publish.rs#L55
warning: long literal lacking separators
--> mqttrust/src/encoding/v4/publish.rs:55:32
|
55 | QoS::AtMostOnce => 0b00110000,
| ^^^^^^^^^^ help: consider: `0b0011_0000`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unreadable_literal
|
long literal lacking separators:
mqttrust/src/encoding/v4/encoder.rs#L135
warning: long literal lacking separators
--> mqttrust/src/encoding/v4/encoder.rs:135:19
|
135 | 2097152..=268435455 => {
| ^^^^^^^^^ help: consider: `268_435_455`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unreadable_literal
|
long literal lacking separators:
mqttrust/src/encoding/v4/encoder.rs#L135
warning: long literal lacking separators
--> mqttrust/src/encoding/v4/encoder.rs:135:9
|
135 | 2097152..=268435455 => {
| ^^^^^^^ help: consider: `2_097_152`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unreadable_literal
|
long literal lacking separators:
mqttrust/src/encoding/v4/encoder.rs#L131
warning: long literal lacking separators
--> mqttrust/src/encoding/v4/encoder.rs:131:17
|
131 | 16384..=2097151 => {
| ^^^^^^^ help: consider: `2_097_151`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unreadable_literal
|
long literal lacking separators:
mqttrust/src/encoding/v4/encoder.rs#L101
warning: long literal lacking separators
--> mqttrust/src/encoding/v4/encoder.rs:101:30
|
101 | let header: u8 = 0b11100000;
| ^^^^^^^^^^ help: consider: `0b1110_0000`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unreadable_literal
|
long literal lacking separators:
mqttrust/src/encoding/v4/encoder.rs#L93
warning: long literal lacking separators
--> mqttrust/src/encoding/v4/encoder.rs:93:30
|
93 | let header: u8 = 0b11010000;
| ^^^^^^^^^^ help: consider: `0b1101_0000`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unreadable_literal
|
long literal lacking separators:
mqttrust/src/encoding/v4/encoder.rs#L85
warning: long literal lacking separators
--> mqttrust/src/encoding/v4/encoder.rs:85:30
|
85 | let header: u8 = 0b11000000;
| ^^^^^^^^^^ help: consider: `0b1100_0000`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unreadable_literal
|
long literal lacking separators:
mqttrust/src/encoding/v4/encoder.rs#L76
warning: long literal lacking separators
--> mqttrust/src/encoding/v4/encoder.rs:76:30
|
76 | let header: u8 = 0b10110000;
| ^^^^^^^^^^ help: consider: `0b1011_0000`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unreadable_literal
|
long literal lacking separators:
mqttrust/src/encoding/v4/encoder.rs#L64
warning: long literal lacking separators
--> mqttrust/src/encoding/v4/encoder.rs:64:30
|
64 | let header: u8 = 0b01110000;
| ^^^^^^^^^^ help: consider: `0b0111_0000`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unreadable_literal
|
long literal lacking separators:
mqttrust/src/encoding/v4/encoder.rs#L55
warning: long literal lacking separators
--> mqttrust/src/encoding/v4/encoder.rs:55:30
|
55 | let header: u8 = 0b01100010;
| ^^^^^^^^^^ help: consider: `0b0110_0010`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unreadable_literal
|
long literal lacking separators:
mqttrust/src/encoding/v4/encoder.rs#L46
warning: long literal lacking separators
--> mqttrust/src/encoding/v4/encoder.rs:46:30
|
46 | let header: u8 = 0b01010000;
| ^^^^^^^^^^ help: consider: `0b0101_0000`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unreadable_literal
|
long literal lacking separators:
mqttrust/src/encoding/v4/encoder.rs#L37
warning: long literal lacking separators
--> mqttrust/src/encoding/v4/encoder.rs:37:30
|
37 | let header: u8 = 0b01000000;
| ^^^^^^^^^^ help: consider: `0b0100_0000`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unreadable_literal
|
long literal lacking separators:
mqttrust/src/encoding/v4/connect.rs#L263
warning: long literal lacking separators
--> mqttrust/src/encoding/v4/connect.rs:263:29
|
263 | let mut flags: u8 = 0b00000000;
| ^^^^^^^^^^ help: consider: `0b0000_0000`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unreadable_literal
|
long literal lacking separators:
mqttrust/src/encoding/v4/connect.rs#L261
warning: long literal lacking separators
--> mqttrust/src/encoding/v4/connect.rs:261:26
|
261 | let header: u8 = 0b00100000;
| ^^^^^^^^^^ help: consider: `0b0010_0000`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unreadable_literal
|
long literal lacking separators:
mqttrust/src/encoding/v4/connect.rs#L216
warning: long literal lacking separators
--> mqttrust/src/encoding/v4/connect.rs:216:34
|
216 | connect_flags |= 0b00100000;
| ^^^^^^^^^^ help: consider: `0b0010_0000`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unreadable_literal
|
long literal lacking separators:
mqttrust/src/encoding/v4/connect.rs#L213
warning: long literal lacking separators
--> mqttrust/src/encoding/v4/connect.rs:213:30
|
213 | connect_flags |= 0b00000100;
| ^^^^^^^^^^ help: consider: `0b0000_0100`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unreadable_literal
|
long literal lacking separators:
mqttrust/src/encoding/v4/connect.rs#L210
warning: long literal lacking separators
--> mqttrust/src/encoding/v4/connect.rs:210:30
|
210 | connect_flags |= 0b01000000;
| ^^^^^^^^^^ help: consider: `0b0100_0000`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unreadable_literal
|
long literal lacking separators:
mqttrust/src/encoding/v4/connect.rs#L207
warning: long literal lacking separators
--> mqttrust/src/encoding/v4/connect.rs:207:30
|
207 | connect_flags |= 0b10000000;
| ^^^^^^^^^^ help: consider: `0b1000_0000`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unreadable_literal
|
long literal lacking separators:
mqttrust/src/encoding/v4/connect.rs#L202
warning: long literal lacking separators
--> mqttrust/src/encoding/v4/connect.rs:202:37
|
202 | let mut connect_flags: u8 = 0b00000000;
| ^^^^^^^^^^ help: consider: `0b0000_0000`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unreadable_literal
|
long literal lacking separators:
mqttrust/src/encoding/v4/connect.rs#L201
warning: long literal lacking separators
--> mqttrust/src/encoding/v4/connect.rs:201:26
|
201 | let header: u8 = 0b00010000;
| ^^^^^^^^^^ help: consider: `0b0001_0000`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unreadable_literal
|
long literal lacking separators:
mqttrust/src/encoding/v4/connect.rs#L161
warning: long literal lacking separators
--> mqttrust/src/encoding/v4/connect.rs:161:43
|
161 | let password = if connect_flags & 0b01000000 != 0 {
| ^^^^^^^^^^ help: consider: `0b0100_0000`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unreadable_literal
|
long literal lacking separators:
mqttrust/src/encoding/v4/connect.rs#L155
warning: long literal lacking separators
--> mqttrust/src/encoding/v4/connect.rs:155:43
|
155 | let username = if connect_flags & 0b10000000 != 0 {
| ^^^^^^^^^^ help: consider: `0b1000_0000`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unreadable_literal
|
long literal lacking separators:
mqttrust/src/encoding/v4/connect.rs#L149
warning: long literal lacking separators
--> mqttrust/src/encoding/v4/connect.rs:149:42
|
149 | retain: (connect_flags & 0b00100000) != 0,
| ^^^^^^^^^^ help: consider: `0b0010_0000`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unreadable_literal
= note: `-W clippy::unreadable-literal` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::unreadable_literal)]`
|
clippy
Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: actions/checkout@v2, actions-rs/toolchain@v1, actions-rs/clippy-check@v1. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.
|
clippy
The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2, actions-rs/toolchain@v1, 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/
|
clippy
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/
|
clippy
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/
|
clippy
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/
|
clippy
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/
|
Test
Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: actions/checkout@v2, actions-rs/toolchain@v1, actions-rs/cargo@v1. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.
|
Test
The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2, actions-rs/toolchain@v1, actions-rs/cargo@v1. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
|
Test
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/
|
Test
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/
|
Test
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/
|
Test
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/
|
Test:
mqttrust/src/fmt.rs#L226
method `into_result` is never used
|
Test
`mqttrust` (lib) generated 1 warning
|
Test:
mqttrust_core/src/fmt.rs#L226
method `into_result` is never used
|
Test
`mqttrust_core` (lib) generated 2 warnings
|
Test:
mqttrust/src/fmt.rs#L226
method `into_result` is never used
|
Test
`mqttrust` (lib) generated 1 warning
|
Test:
mqttrust_core/src/eventloop.rs#L708
creating a mutable reference to mutable static is discouraged
|
Test:
mqttrust_core/src/eventloop.rs#L757
creating a mutable reference to mutable static is discouraged
|
Test:
mqttrust_core/src/state.rs#L84
creating a mutable reference to mutable static is discouraged
|
Test:
mqttrust_core/src/state.rs#L528
creating a mutable reference to mutable static is discouraged
|
Test
`mqttrust_core` (lib test) generated 4 warnings
|
Coverage
Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: actions/checkout@v2, actions-rs/toolchain@v1, actions-rs/cargo@v1. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.
|
Coverage
The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2, actions-rs/toolchain@v1, actions-rs/cargo@v1. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
|
Coverage:
mqttrust/src/fmt.rs#L226
method `into_result` is never used
|
Coverage
`mqttrust` (lib) generated 1 warning
|
Coverage:
mqttrust_core/src/eventloop.rs#L708
creating a mutable reference to mutable static is discouraged
|
Coverage:
mqttrust_core/src/eventloop.rs#L757
creating a mutable reference to mutable static is discouraged
|
Coverage:
mqttrust_core/src/state.rs#L84
creating a mutable reference to mutable static is discouraged
|
Coverage:
mqttrust_core/src/state.rs#L528
creating a mutable reference to mutable static is discouraged
|
Coverage
`mqttrust_core` (lib test) generated 4 warnings
|
Coverage
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/
|
Coverage
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/
|
Coverage
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/
|
Coverage
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/
|