Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fix existing Clippy warnings #47

Open
henrikssn opened this issue Nov 19, 2021 · 0 comments · May be fixed by #61
Open

Fix existing Clippy warnings #47

henrikssn opened this issue Nov 19, 2021 · 0 comments · May be fixed by #61
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@henrikssn
Copy link
Member

warning: this expression borrows a reference (`&[u8]`) that is immediately dereferenced by the compiler
Warning:    --> src/mac/beacon.rs:105:19
    |
105 |         check_len(&bytes, 2)?;
    |                   ^^^^^^ help: change this to: `bytes`
    |
    = note: `#[warn(clippy::needless_borrow)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

warning: using `clone` on type `mac::beacon::BeaconOrder` which implements the `Copy` trait
Warning:    --> src/mac/beacon.rs:133:27
    |
133 |         let bo = u8::from(self.beacon_order.clone());
    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `self.beacon_order`
    |
    = note: `#[warn(clippy::clone_on_copy)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy

warning: using `clone` on type `mac::beacon::SuperframeOrder` which implements the `Copy` trait
Warning:    --> src/mac/beacon.rs:134:27
    |
134 |         let so = u8::from(self.superframe_order.clone());
    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `self.superframe_order`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy

warning: you should consider adding a `Default` implementation for `GuaranteedTimeSlotDescriptor`
Warning:    --> src/mac/beacon.rs:182:5
    |
182 | /     pub fn new() -> Self {
183 | |         GuaranteedTimeSlotDescriptor {
184 | |             short_address: ShortAddress::broadcast(),
185 | |             starting_slot: 0,
...   |
188 | |         }
189 | |     }
    | |_____^
    |
    = note: `#[warn(clippy::new_without_default)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try adding this
    |
180 + impl Default for GuaranteedTimeSlotDescriptor {
181 +     fn default() -> Self {
182 +         Self::new()
183 +     }
184 + }
    |

warning: this expression borrows a reference (`&[u8]`) that is immediately dereferenced by the compiler
Warning:    --> src/mac/beacon.rs:195:19
    |
195 |         check_len(&bytes, 3)?;
    |                   ^^^^^^ help: change this to: `bytes`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

warning: you should consider adding a `Default` implementation for `GuaranteedTimeSlotInformation`
Warning:    --> src/mac/beacon.rs:248:5
    |
248 | /     pub fn new() -> Self {
249 | |         GuaranteedTimeSlotInformation {
250 | |             permit: false,
251 | |             slot_count: 0,
252 | |             slots: [GuaranteedTimeSlotDescriptor::new(); 7],
253 | |         }
254 | |     }
    | |_____^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try adding this
    |
246 + impl Default for GuaranteedTimeSlotInformation {
247 +     fn default() -> Self {
248 +         Self::new()
249 +     }
250 + }
    |

warning: manual implementation of an assign operation
Warning:    --> src/mac/beacon.rs:278:25
    |
278 |                         direction_mask = direction_mask | dir;
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `direction_mask |= dir`
    |
    = note: `#[warn(clippy::assign_op_pattern)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern

warning: manual implementation of an assign operation
Warning:    --> src/mac/beacon.rs:280:21
    |
280 |                     dir = dir << 1;
    |                     ^^^^^^^^^^^^^^ help: replace it with: `dir <<= 1`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern

warning: the loop variable `n` is only used to index `slots`
Warning:    --> src/mac/beacon.rs:310:22
    |
310 |             for n in 0..slot_count {
    |                      ^^^^^^^^^^^^^
    |
    = note: `#[warn(clippy::needless_range_loop)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop
help: consider using an iterator
    |
310 |             for <item> in slots.iter_mut().take(slot_count) {
    |                 ~~~~~~    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

warning: manual implementation of an assign operation
Warning:    --> src/mac/beacon.rs:319:17
    |
319 |                 direction_mask = direction_mask >> 1;
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `direction_mask >>= 1`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern

warning: you should consider adding a `Default` implementation for `PendingAddress`
Warning:    --> src/mac/beacon.rs:367:5
    |
367 | /     pub fn new() -> Self {
368 | |         PendingAddress {
369 | |             short_address_count: 0,
370 | |             short_addresses: [ShortAddress::broadcast(); 7],
...   |
373 | |         }
374 | |     }
    | |_____^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try adding this
    |
365 + impl Default for PendingAddress {
366 +     fn default() -> Self {
367 +         Self::new()
368 +     }
369 + }
    |

warning: the loop variable `n` is only used to index `short_addresses`
Warning:    --> src/mac/beacon.rs:396:18
    |
396 |         for n in 0..sl {
    |                  ^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop
help: consider using an iterator
    |
396 |         for <item> in short_addresses.iter_mut().take(sl) {
    |             ~~~~~~    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

warning: the loop variable `n` is only used to index `extended_addresses`
Warning:    --> src/mac/beacon.rs:400:18
    |
400 |         for n in 0..el {
    |                  ^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop
help: consider using an iterator
    |
400 |         for <item> in extended_addresses.iter_mut().take(el) {
    |             ~~~~~~    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

warning: re-implementing `PartialEq::ne` is unnecessary
Warning:   --> src/utils.rs:59:13
   |
59 | /             fn ne(&self, other: &$name) -> bool {
60 | |                 match *other {
61 | |                     $( $name::$var => *self != $val, )*
62 | |                 }
63 | |             }
   | |_____________^
   |
  ::: src/mac/command.rs:12:1
   |
12 | / extended_enum!(
13 | |     /// MAC command identifiers
14 | |     CommandId, u8,
15 | |     /// Association request, request association to PAN
...  |
32 | |     GuaranteedTimeSlotRequest => 9,
33 | | );
   | |__- in this macro invocation
   |
   = note: `#[warn(clippy::partialeq_ne_impl)]` on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#partialeq_ne_impl
   = note: this warning originates in the macro `extended_enum` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: manual implementation of an assign operation
Warning:   --> src/mac/command.rs:83:13
   |
83 |             byte = byte | CAP_FFD;
   |             ^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `byte |= CAP_FFD`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern

warning: manual implementation of an assign operation
Warning:   --> src/mac/command.rs:86:13
   |
86 |             byte = byte | CAP_MAINS_POWER;
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `byte |= CAP_MAINS_POWER`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern

warning: manual implementation of an assign operation
Warning:   --> src/mac/command.rs:89:13
   |
89 |             byte = byte | CAP_IDLE_RECEIVE;
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `byte |= CAP_IDLE_RECEIVE`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern

warning: manual implementation of an assign operation
Warning:   --> src/mac/command.rs:92:13
   |
92 |             byte = byte | CAP_FRAME_PROTECTION;
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `byte |= CAP_FRAME_PROTECTION`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern

warning: manual implementation of an assign operation
Warning:   --> src/mac/command.rs:95:13
   |
95 |             byte = byte | CAP_ALLOCATE_ADDRESS;
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `byte |= CAP_ALLOCATE_ADDRESS`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern

warning: re-implementing `PartialEq::ne` is unnecessary
Warning:    --> src/utils.rs:59:13
    |
59  | /             fn ne(&self, other: &$name) -> bool {
60  | |                 match *other {
61  | |                     $( $name::$var => *self != $val, )*
62  | |                 }
63  | |             }
    | |_____________^
    |
   ::: src/mac/command.rs:101:1
    |
101 | / extended_enum!(
102 | |     /// Association Status
103 | |     AssociationStatus, u8,
104 | |     /// Successful
...   |
113 | |     FastAssociationSuccesful => 0x80,
114 | | );
    | |__- in this macro invocation
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#partialeq_ne_impl
    = note: this warning originates in the macro `extended_enum` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: re-implementing `PartialEq::ne` is unnecessary
Warning:    --> src/utils.rs:59:13
    |
59  | /             fn ne(&self, other: &$name) -> bool {
60  | |                 match *other {
61  | |                     $( $name::$var => *self != $val, )*
62  | |                 }
63  | |             }
    | |_____________^
    |
   ::: src/mac/command.rs:116:1
    |
116 | / extended_enum!(
117 | |     /// Disassociation Reason
118 | |     DisassociationReason, u8,
119 | |     /// Coordinator requested device to leave
...   |
122 | |     DeviceLeave => 2,
123 | | );
    | |__- in this macro invocation
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#partialeq_ne_impl
    = note: this warning originates in the macro `extended_enum` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: this expression borrows a reference (`&[u8]`) that is immediately dereferenced by the compiler
Warning:    --> src/mac/command.rs:160:19
    |
160 |         check_len(&bytes, 7)?;
    |                   ^^^^^^ help: change this to: `bytes`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

warning: manual implementation of an assign operation
Warning:    --> src/mac/command.rs:216:13
    |
216 |             byte = byte | GTSC_RECEIVE_ONLY;
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `byte |= GTSC_RECEIVE_ONLY`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern

warning: manual implementation of an assign operation
Warning:    --> src/mac/command.rs:219:13
    |
219 |             byte = byte | GTSC_ALLOCATION;
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `byte |= GTSC_ALLOCATION`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern

warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
Warning:    --> src/mac/frame/header.rs:92:13
    |
92  | /             match i {
93  | |                 Some(addr) => {
94  | |                     // pan ID
95  | |                     len += 2;
...   |
102 | |                 _ => {}
103 | |             }
    | |_____________^
    |
    = note: `#[warn(clippy::single_match)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
help: try this
    |
92  ~             if let Some(addr) = i {
93  +                 // pan ID
94  +                 len += 2;
95  +                 // Address length
96  +                 match addr {
97  +                     Address::Short(..) => len += 2,
  ...

warning: this expression borrows a reference (`&[u8]`) that is immediately dereferenced by the compiler
Warning:    --> src/mac/frame/header.rs:118:19
    |
118 |         check_len(&bytes, 3)?;
    |                   ^^^^^^ help: change this to: `bytes`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

warning: returning an `Err(_)` with the `?` operator
Warning:    --> src/mac/frame/header.rs:287:20
    |
287 |             return Err(EncodeError::MissingSecurityCtx)?;
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `Err(EncodeError::MissingSecurityCtx.into())`
    |
    = note: `#[warn(clippy::try_err)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#try_err

warning: returning an `Err(_)` with the `?` operator
Warning:    --> src/mac/frame/header.rs:294:36
    |
294 |                     None => return Err(EncodeError::UnknownError)?,
    |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `Err(EncodeError::UnknownError.into())`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#try_err

warning: returning an `Err(_)` with the `?` operator
Warning:    --> src/mac/frame/header.rs:296:32
    |
296 |                 None => return Err(EncodeError::UnknownError)?,
    |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `Err(EncodeError::UnknownError.into())`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#try_err

warning: returning the result of a `let` binding from a block
Warning:   --> src/mac/frame/security/auxiliary_security_header.rs:40:9
   |
28 | /         let length = 1
29 | |             + 4
30 | |             + match self.key_identifier {
31 | |                 Some(key_id) => match key_id.key_source {
...  |
38 | |                 None => 0,
39 | |             };
   | |______________- unnecessary `let` binding
40 |           length
   |           ^^^^^^
   |
   = note: `#[warn(clippy::let_and_return)]` on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return
help: return the expression directly
   |
28 ~         
29 ~         1
30 +             + 4
31 +             + match self.key_identifier {
32 +                 Some(key_id) => match key_id.key_source {
33 +                     Some(source) => match source {
 ...

warning: unsafe function's docs miss `# Safety` section
Warning:   --> src/mac/frame/security/auxiliary_security_header.rs:59:5
   |
59 | /     pub unsafe fn new_unsafe(
60 | |         control: SecurityControl,
61 | |         key_identifier: Option<KeyIdentifier>,
62 | |         frame_counter: u32,
...  |
68 | |         }
69 | |     }
   | |_____^
   |
   = note: `#[warn(clippy::missing_safety_doc)]` on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_safety_doc

warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
Warning:    --> src/mac/frame/security/auxiliary_security_header.rs:146:9
    |
146 | /         match self.key_identifier {
147 | |             Some(key_identifier) => {
148 | |                 bytes.write(offset, key_identifier)?;
149 | |             }
150 | |             _ => {}
151 | |         }
    | |_________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
help: try this
    |
146 ~         if let Some(key_identifier) = self.key_identifier {
147 +             bytes.write(offset, key_identifier)?;
148 +         }
    |

warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
Warning:    --> src/mac/frame/security/auxiliary_security_header.rs:169:9
    |
169 | /         match self.key_source {
170 | |             Some(source) => match source {
171 | |                 KeySource::Short(src) => bytes.write(offset, src)?,
172 | |                 KeySource::Long(src) => bytes.write(offset, src)?,
173 | |             },
174 | |             _ => {}
175 | |         }
    | |_________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
help: try this
    |
169 ~         if let Some(source) = self.key_source { match source {
170 +             KeySource::Short(src) => bytes.write(offset, src)?,
171 +             KeySource::Long(src) => bytes.write(offset, src)?,
172 +         } }
    |

warning: methods with the following characteristics: (`to_*` and `self` type is `Copy`) usually take `self` by value
Warning:    --> src/mac/frame/security/security_control.rs:104:27
    |
104 |     pub(crate) fn to_bits(&self) -> u8 {
    |                           ^^^^^
    |
    = note: `#[warn(clippy::wrong_self_convention)]` on by default
    = 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

warning: methods with the following characteristics: (`to_*` and `self` type is `Copy`) usually take `self` by value
Warning:    --> src/mac/frame/security/security_control.rs:153:16
    |
153 |     fn to_bits(&self) -> 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

warning: the loop variable `i` is used to index `output`
Warning:    --> src/mac/frame/security/mod.rs:306:14
    |
306 |     for i in 0..8 {
    |              ^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop
help: consider using an iterator
    |
306 |     for (i, <item>) in output.iter_mut().enumerate().take(8) {
    |         ~~~~~~~~~~~    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

warning: this lifetime isn't used in the function definition
Warning:    --> src/mac/frame/security/mod.rs:329:28
    |
329 | pub(crate) fn secure_frame<'a, AEADBLKCIPH, KEYDESCLO>(
    |                            ^^
    |
    = note: `#[warn(clippy::extra_unused_lifetimes)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes

warning: this boolean expression can be simplified
Warning:    --> src/mac/frame/security/mod.rs:371:16
    |
371 |               if !(frame.payload.len()
    |  ________________^
372 | |                 + frame.header.get_octet_size()
373 | |                 + aux_len
374 | |                 + auth_len
375 | |                 + 2
376 | |                 <= 127)
    | |_______________________^
    |
    = note: `#[warn(clippy::nonminimal_bool)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool
help: try
    |
371 ~             if frame.payload.len()
372 +                 + frame.header.get_octet_size()
373 +                 + aux_len
374 +                 + auth_len
375 +                 + 2 > 127
    |

warning: unneeded `return` statement
Warning:    --> src/mac/frame/security/mod.rs:485:17
    |
485 |                 return Ok(offset);
    |                 ^^^^^^^^^^^^^^^^^^ help: remove `return`: `Ok(offset)`
    |
    = note: `#[warn(clippy::needless_return)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return

warning: unneeded `return` statement
Warning:    --> src/mac/frame/security/mod.rs:487:17
    |
487 |                 return Err(SecurityError::UnavailableKey);
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `Err(SecurityError::UnavailableKey)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return

warning: unneeded `return` statement
Warning:    --> src/mac/frame/security/mod.rs:490:13
    |
490 |             return Err(SecurityError::AuxSecHeaderAbsent);
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `Err(SecurityError::AuxSecHeaderAbsent)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return

warning: unneeded `return` statement
Warning:    --> src/mac/frame/security/mod.rs:493:9
    |
493 |         return Err(SecurityError::SecurityNotEnabled);
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `Err(SecurityError::SecurityNotEnabled)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return

warning: casting integer literal to `usize` is unnecessary
Warning:    --> src/mac/frame/security/mod.rs:350:22
    |
350 |     let mut offset = 0 as usize;
    |                      ^^^^^^^^^^ help: try: `0_usize`
    |
    = note: `#[warn(clippy::unnecessary_cast)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

warning: the method `encrypt_in_place_detached` doesn't need a mutable reference
Warning:    --> src/mac/frame/security/mod.rs:435:33
    |
435 |                                   &mut [],
    |                                   ^^^^^^^
...
462 | /                         do_secure!(
463 | |                             U4,
464 | |                             SecurityLevel::MIC32,
465 | |                             SecurityLevel::ENCMIC32
466 | |                         );
    | |__________________________- in this macro invocation
    |
    = note: `#[warn(clippy::unnecessary_mut_passed)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed
    = note: this warning originates in the macro `do_secure` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: the method `encrypt_in_place_detached` doesn't need a mutable reference
Warning:    --> src/mac/frame/security/mod.rs:435:33
    |
435 |                                   &mut [],
    |                                   ^^^^^^^
...
469 | /                         do_secure!(
470 | |                             U8,
471 | |                             SecurityLevel::MIC64,
472 | |                             SecurityLevel::ENCMIC64
473 | |                         );
    | |__________________________- in this macro invocation
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed
    = note: this warning originates in the macro `do_secure` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: the method `encrypt_in_place_detached` doesn't need a mutable reference
Warning:    --> src/mac/frame/security/mod.rs:435:33
    |
435 |                                   &mut [],
    |                                   ^^^^^^^
...
476 | /                         do_secure!(
477 | |                             CcmU16,
478 | |                             SecurityLevel::MIC128,
479 | |                             SecurityLevel::ENCMIC128
480 | |                         );
    | |__________________________- in this macro invocation
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed
    = note: this warning originates in the macro `do_secure` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: this lifetime isn't used in the function definition
Warning:    --> src/mac/frame/security/mod.rs:513:30
    |
513 | pub(crate) fn unsecure_frame<'a, AEADBLKCIPH, KEYDESCLO, DEVDESCLO>(
    |                              ^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes

warning: unneeded `return` statement
Warning:    --> src/mac/frame/security/mod.rs:673:9
    |
673 |         return Ok(taglen);
    |         ^^^^^^^^^^^^^^^^^^ help: remove `return`: `Ok(taglen)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return

warning: unneeded `return` statement
Warning:    --> src/mac/frame/security/mod.rs:675:9
    |
675 |         return Err(SecurityError::SecurityNotEnabled);
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `Err(SecurityError::SecurityNotEnabled)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return

warning: the method `decrypt_in_place_detached` doesn't need a mutable reference
Warning:    --> src/mac/frame/security/mod.rs:621:37
    |
621 |   ...                           &mut [],
    |                                 ^^^^^^^
...
644 | / ...                   do_unsecure!(
645 | | ...                       U4,
646 | | ...                       SecurityLevel::MIC32,
647 | | ...                       SecurityLevel::ENCMIC32
648 | | ...                   );
    | |________________________- in this macro invocation
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed
    = note: this warning originates in the macro `do_unsecure` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: the method `decrypt_in_place_detached` doesn't need a mutable reference
Warning:    --> src/mac/frame/security/mod.rs:621:37
    |
621 |   ...                           &mut [],
    |                                 ^^^^^^^
...
651 | / ...                   do_unsecure!(
652 | | ...                       U8,
653 | | ...                       SecurityLevel::MIC64,
654 | | ...                       SecurityLevel::ENCMIC64
655 | | ...                   );
    | |________________________- in this macro invocation
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed
    = note: this warning originates in the macro `do_unsecure` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: the method `decrypt_in_place_detached` doesn't need a mutable reference
Warning:    --> src/mac/frame/security/mod.rs:621:37
    |
621 |   ...                           &mut [],
    |                                 ^^^^^^^
...
658 | / ...                   do_unsecure!(
659 | | ...                       U16,
660 | | ...                       SecurityLevel::MIC128,
661 | | ...                       SecurityLevel::ENCMIC128
662 | | ...                   );
    | |________________________- in this macro invocation
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed
    = note: this warning originates in the macro `do_unsecure` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: returning an `Err(_)` with the `?` operator
Warning:    --> src/mac/frame/mod.rs:252:33
    |
252 |                     _ => return Err(e)?,
    |                                 ^^^^^^^ help: try this: `Err(e.into())`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#try_err

warning: returning an `Err(_)` with the `?` operator
Warning:    --> src/mac/frame/mod.rs:346:20
    |
346 |             return Err(DecodeError::SecurityEnabled)?;
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `Err(DecodeError::SecurityEnabled.into())`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#try_err

warning: `ieee802154` (lib) generated 54 warnings
Warning:     Finished dev [unoptimized + debuginfo] target(s) in 53.51s
@henrikssn henrikssn added help wanted Extra attention is needed good first issue Good for newcomers labels Nov 19, 2021
richardbrodie pushed a commit to richardbrodie/rust-ieee802.15.4 that referenced this issue Feb 20, 2023
@richardbrodie richardbrodie linked a pull request Feb 20, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant