Skip to content

(WIP) Rework of DTLS code, add DTLS PKI/RPK #158

(WIP) Rework of DTLS code, add DTLS PKI/RPK

(WIP) Rework of DTLS code, add DTLS PKI/RPK #158

GitHub Actions / clippy (libcoap-rs) completed Sep 10, 2024 in 1s

reviewdog [clippy (libcoap-rs)] report

reported by reviewdog 🐶

Findings (14)

libcoap/src/crypto/psk/mod.rs|9 col 5| warning: unused import: std::fmt::Debug
--> libcoap/src/crypto/psk/mod.rs:9:5
|
9 | use std::fmt::Debug;
| ^^^^^^^^^^^^^^^
|
= note: #[warn(unused_imports)] on by default
libcoap/src/mem.rs|534 col 15| warning: function boxed_slice_into_parts is never used
--> libcoap/src/mem.rs:534:15
|
534 | pub(crate) fn boxed_slice_into_parts(data: Box<[T]>) -> (NonNull, usize) {
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: #[warn(dead_code)] on by default
libcoap/src/mem.rs|540 col 22| warning: function boxed_slice_from_raw_parts is never used
--> libcoap/src/mem.rs:540:22
|
540 | pub(crate) unsafe fn boxed_slice_from_raw_parts(data: *mut T, len: usize) -> Box<[T]> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
libcoap/src/mem.rs|544 col 22| warning: function try_boxed_slice_from_raw_parts is never used
--> libcoap/src/mem.rs:544:22
|
544 | pub(crate) unsafe fn try_boxed_slice_from_raw_parts(data: *mut T, len: usize) -> Option<Box<[T]>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
libcoap/src/crypto/psk/client.rs|46 col 37| warning: use of .then_some(..).unwrap_or(..) can be written more clearly with if .. else ..
--> libcoap/src/crypto/psk/client.rs:46:37
|
46 | self.ctx.raw_cfg.ec_jpake = ec_jpake.then_some(1).unwrap_or(0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: if ec_jpake { 1 } else { 0 }
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#obfuscated_if_else
= note: #[warn(clippy::obfuscated_if_else)] on by default
libcoap/src/crypto/psk/client.rs|52 col 36| warning: use of .then_some(..).unwrap_or(..) can be written more clearly with if .. else ..
--> libcoap/src/crypto/psk/client.rs:52:36
|
52 | self.ctx.raw_cfg.use_cid = use_cid.then_some(1).unwrap_or(0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: if use_cid { 1 } else { 0 }
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#obfuscated_if_else
libcoap/src/crypto/psk/client.rs|214 col 6| warning: this lifetime isn't used in the impl
--> libcoap/src/crypto/psk/client.rs:214:6
|
214 | impl<'a, T: Debug> ClientPskHintKeyProvider for T
| ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes
= note: #[warn(clippy::extra_unused_lifetimes)] on by default
libcoap/src/crypto/psk/client.rs|220 col 39| warning: derefed type is same as origin
--> libcoap/src/crypto/psk/client.rs:220:39
|
220 | if identity_hint.is_none() || key.identity().as_deref() == identity_hint {
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: key.identity()
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_option_as_deref
= note: #[warn(clippy::needless_option_as_deref)] on by default
libcoap/src/crypto/psk/key.rs|117 col 43| warning: casting the result of from_raw_parts_mut to *mut [u8]
--> libcoap/src/crypto/psk/key.rs:117:43
|
117 | let data = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(key.s as *mut u8, key.length) as *mut [u8]) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: core::ptr::slice_from_raw_parts_mut(key.s as *mut u8, key.length)
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_slice_from_raw_parts
= note: #[warn(clippy::cast_slice_from_raw_parts)] on by default
libcoap/src/crypto/psk/key.rs|126 col 19| warning: useless conversion to the same type: std::boxed::Box<[u8]>
--> libcoap/src/crypto/psk/key.rs:126:19
|
126 | data: value.into(),
| ^^^^^^^^^^^^ help: consider removing .into(): value
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
libcoap/src/crypto/psk/server.rs|46 col 37| warning: use of .then_some(..).unwrap_or(..) can be written more clearly with if .. else ..
--> libcoap/src/crypto/psk/server.rs:46:37
|
46 | self.ctx.raw_cfg.ec_jpake = ec_jpake.then_some(1).unwrap_or(0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: if ec_jpake { 1 } else { 0 }
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#obfuscated_if_else
libcoap/src/crypto/psk/server.rs|229 col 23| warning: derefed type is same as origin
--> libcoap/src/crypto/psk/server.rs:229:23
|
229 | .find(|k| k.identity().as_deref().is_some_and(|kid| kid == identity))
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try: k.identity()
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_option_as_deref
libcoap/src/crypto/psk/server.rs|248 col 20| warning: this call to as_ref does nothing
--> libcoap/src/crypto/psk/server.rs:248:20
|
248 | let keys = self.as_ref();
| ^^^^^^^^^^^^^ help: try: self
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_asref
= note: #[warn(clippy::useless_asref)] on by default
libcoap/src/types.rs|761 col 17| warning: using libc::strlen on a CString or CStr value
--> libcoap/src/types.rs:761:17
|
761 | libc::strlen(uri.uri_str.0.as_ptr()),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: uri.uri_str.0.as_bytes().len()
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#strlen_on_c_strings
= note: #[warn(clippy::strlen_on_c_strings)] on by default

Filtered Findings (4)

libcoap/src/types.rs|379 col 86| warning: can be more succinctly written as a byte str
--> libcoap/src/types.rs:379:86
|
379 | Self::construct_uri_string_from_parts(scheme, host, port, path.unwrap_or(&[b'/']), query.unwrap_or(&[]))?;
| ^^^^^^^ help: try: b"/"
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#byte_char_slices
= note: #[warn(clippy::byte_char_slices)] on by default
libcoap/src/types.rs|419 col 86| warning: can be more succinctly written as a byte str
--> libcoap/src/types.rs:419:86
|
419 | Self::construct_uri_string_from_parts(scheme, host, port, path.unwrap_or(&[b'/']), query.unwrap_or(&[]))?;
| ^^^^^^^ help: try: b"/"
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#byte_char_slices
libcoap/src/resource.rs|104 col 11| warning: methods uri_path and as_any are never used
--> libcoap/src/resource.rs:106:8
|
104 | pub trait UntypedCoapResource: Any + Debug {
| ------------------- methods in this trait
105 | /// Returns the uri_path this resource responds to.
106 | fn uri_path(&self) -> &str;
| ^^^^^^^^
...
113 | fn as_any(&self) -> &dyn Any;
| ^^^^^^
libcoap/src/context.rs|100 col 17| warning: useless conversion to the same type: u32
--> libcoap/src/context.rs:100:17
|
100 | / (COAP_BLOCK_USE_LIBCOAP | COAP_BLOCK_SINGLE_BODY)
101 | | .try_into()
| |_______________________________^
|
= help: consider removing .try_into()
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
= note: #[warn(clippy::useless_conversion)] on by default

Annotations

Check warning on line 9 in libcoap/src/crypto/psk/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy (libcoap-rs)

[clippy (libcoap-rs)] libcoap/src/crypto/psk/mod.rs#L9

warning: unused import: `std::fmt::Debug`
 --> libcoap/src/crypto/psk/mod.rs:9:5
  |
9 | use std::fmt::Debug;
  |     ^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default
Raw output
libcoap/src/crypto/psk/mod.rs:9:5:w:warning: unused import: `std::fmt::Debug`
 --> libcoap/src/crypto/psk/mod.rs:9:5
  |
9 | use std::fmt::Debug;
  |     ^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default


__END__

Check warning on line 534 in libcoap/src/mem.rs

See this annotation in the file changed.

@github-actions github-actions / clippy (libcoap-rs)

[clippy (libcoap-rs)] libcoap/src/mem.rs#L534

warning: function `boxed_slice_into_parts` is never used
   --> libcoap/src/mem.rs:534:15
    |
534 | pub(crate) fn boxed_slice_into_parts<T>(data: Box<[T]>) -> (NonNull<T>, usize) {
    |               ^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `#[warn(dead_code)]` on by default
Raw output
libcoap/src/mem.rs:534:15:w:warning: function `boxed_slice_into_parts` is never used
   --> libcoap/src/mem.rs:534:15
    |
534 | pub(crate) fn boxed_slice_into_parts<T>(data: Box<[T]>) -> (NonNull<T>, usize) {
    |               ^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `#[warn(dead_code)]` on by default


__END__

Check warning on line 540 in libcoap/src/mem.rs

See this annotation in the file changed.

@github-actions github-actions / clippy (libcoap-rs)

[clippy (libcoap-rs)] libcoap/src/mem.rs#L540

warning: function `boxed_slice_from_raw_parts` is never used
   --> libcoap/src/mem.rs:540:22
    |
540 | pub(crate) unsafe fn boxed_slice_from_raw_parts<T>(data: *mut T, len: usize) -> Box<[T]> {
    |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
Raw output
libcoap/src/mem.rs:540:22:w:warning: function `boxed_slice_from_raw_parts` is never used
   --> libcoap/src/mem.rs:540:22
    |
540 | pub(crate) unsafe fn boxed_slice_from_raw_parts<T>(data: *mut T, len: usize) -> Box<[T]> {
    |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^


__END__

Check warning on line 544 in libcoap/src/mem.rs

See this annotation in the file changed.

@github-actions github-actions / clippy (libcoap-rs)

[clippy (libcoap-rs)] libcoap/src/mem.rs#L544

warning: function `try_boxed_slice_from_raw_parts` is never used
   --> libcoap/src/mem.rs:544:22
    |
544 | pub(crate) unsafe fn try_boxed_slice_from_raw_parts<T>(data: *mut T, len: usize) -> Option<Box<[T]>> {
    |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Raw output
libcoap/src/mem.rs:544:22:w:warning: function `try_boxed_slice_from_raw_parts` is never used
   --> libcoap/src/mem.rs:544:22
    |
544 | pub(crate) unsafe fn try_boxed_slice_from_raw_parts<T>(data: *mut T, len: usize) -> Option<Box<[T]>> {
    |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


__END__

Check warning on line 46 in libcoap/src/crypto/psk/client.rs

See this annotation in the file changed.

@github-actions github-actions / clippy (libcoap-rs)

[clippy (libcoap-rs)] libcoap/src/crypto/psk/client.rs#L46

warning: use of `.then_some(..).unwrap_or(..)` can be written more clearly with `if .. else ..`
  --> libcoap/src/crypto/psk/client.rs:46:37
   |
46 |         self.ctx.raw_cfg.ec_jpake = ec_jpake.then_some(1).unwrap_or(0);
   |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `if ec_jpake { 1 } else { 0 }`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#obfuscated_if_else
   = note: `#[warn(clippy::obfuscated_if_else)]` on by default
Raw output
libcoap/src/crypto/psk/client.rs:46:37:w:warning: use of `.then_some(..).unwrap_or(..)` can be written more clearly with `if .. else ..`
  --> libcoap/src/crypto/psk/client.rs:46:37
   |
46 |         self.ctx.raw_cfg.ec_jpake = ec_jpake.then_some(1).unwrap_or(0);
   |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `if ec_jpake { 1 } else { 0 }`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#obfuscated_if_else
   = note: `#[warn(clippy::obfuscated_if_else)]` on by default


__END__

Check warning on line 52 in libcoap/src/crypto/psk/client.rs

See this annotation in the file changed.

@github-actions github-actions / clippy (libcoap-rs)

[clippy (libcoap-rs)] libcoap/src/crypto/psk/client.rs#L52

warning: use of `.then_some(..).unwrap_or(..)` can be written more clearly with `if .. else ..`
  --> libcoap/src/crypto/psk/client.rs:52:36
   |
52 |         self.ctx.raw_cfg.use_cid = use_cid.then_some(1).unwrap_or(0);
   |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `if use_cid { 1 } else { 0 }`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#obfuscated_if_else
Raw output
libcoap/src/crypto/psk/client.rs:52:36:w:warning: use of `.then_some(..).unwrap_or(..)` can be written more clearly with `if .. else ..`
  --> libcoap/src/crypto/psk/client.rs:52:36
   |
52 |         self.ctx.raw_cfg.use_cid = use_cid.then_some(1).unwrap_or(0);
   |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `if use_cid { 1 } else { 0 }`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#obfuscated_if_else


__END__

Check warning on line 214 in libcoap/src/crypto/psk/client.rs

See this annotation in the file changed.

@github-actions github-actions / clippy (libcoap-rs)

[clippy (libcoap-rs)] libcoap/src/crypto/psk/client.rs#L214

warning: this lifetime isn't used in the impl
   --> libcoap/src/crypto/psk/client.rs:214:6
    |
214 | impl<'a, T: Debug> ClientPskHintKeyProvider for T
    |      ^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes
    = note: `#[warn(clippy::extra_unused_lifetimes)]` on by default
Raw output
libcoap/src/crypto/psk/client.rs:214:6:w:warning: this lifetime isn't used in the impl
   --> libcoap/src/crypto/psk/client.rs:214:6
    |
214 | impl<'a, T: Debug> ClientPskHintKeyProvider for T
    |      ^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes
    = note: `#[warn(clippy::extra_unused_lifetimes)]` on by default


__END__

Check warning on line 220 in libcoap/src/crypto/psk/client.rs

See this annotation in the file changed.

@github-actions github-actions / clippy (libcoap-rs)

[clippy (libcoap-rs)] libcoap/src/crypto/psk/client.rs#L220

warning: derefed type is same as origin
   --> libcoap/src/crypto/psk/client.rs:220:39
    |
220 |         if identity_hint.is_none() || key.identity().as_deref() == identity_hint {
    |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `key.identity()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_option_as_deref
    = note: `#[warn(clippy::needless_option_as_deref)]` on by default
Raw output
libcoap/src/crypto/psk/client.rs:220:39:w:warning: derefed type is same as origin
   --> libcoap/src/crypto/psk/client.rs:220:39
    |
220 |         if identity_hint.is_none() || key.identity().as_deref() == identity_hint {
    |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `key.identity()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_option_as_deref
    = note: `#[warn(clippy::needless_option_as_deref)]` on by default


__END__

Check warning on line 117 in libcoap/src/crypto/psk/key.rs

See this annotation in the file changed.

@github-actions github-actions / clippy (libcoap-rs)

[clippy (libcoap-rs)] libcoap/src/crypto/psk/key.rs#L117

warning: casting the result of `from_raw_parts_mut` to *mut [u8]
   --> libcoap/src/crypto/psk/key.rs:117:43
    |
117 |         let data = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(key.s as *mut u8, key.length) as *mut [u8]) };
    |                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `core::ptr::slice_from_raw_parts_mut(key.s as *mut u8, key.length)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_slice_from_raw_parts
    = note: `#[warn(clippy::cast_slice_from_raw_parts)]` on by default
Raw output
libcoap/src/crypto/psk/key.rs:117:43:w:warning: casting the result of `from_raw_parts_mut` to *mut [u8]
   --> libcoap/src/crypto/psk/key.rs:117:43
    |
117 |         let data = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(key.s as *mut u8, key.length) as *mut [u8]) };
    |                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `core::ptr::slice_from_raw_parts_mut(key.s as *mut u8, key.length)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_slice_from_raw_parts
    = note: `#[warn(clippy::cast_slice_from_raw_parts)]` on by default


__END__

Check warning on line 126 in libcoap/src/crypto/psk/key.rs

See this annotation in the file changed.

@github-actions github-actions / clippy (libcoap-rs)

[clippy (libcoap-rs)] libcoap/src/crypto/psk/key.rs#L126

warning: useless conversion to the same type: `std::boxed::Box<[u8]>`
   --> libcoap/src/crypto/psk/key.rs:126:19
    |
126 |             data: value.into(),
    |                   ^^^^^^^^^^^^ help: consider removing `.into()`: `value`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
Raw output
libcoap/src/crypto/psk/key.rs:126:19:w:warning: useless conversion to the same type: `std::boxed::Box<[u8]>`
   --> libcoap/src/crypto/psk/key.rs:126:19
    |
126 |             data: value.into(),
    |                   ^^^^^^^^^^^^ help: consider removing `.into()`: `value`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion


__END__

Check warning on line 46 in libcoap/src/crypto/psk/server.rs

See this annotation in the file changed.

@github-actions github-actions / clippy (libcoap-rs)

[clippy (libcoap-rs)] libcoap/src/crypto/psk/server.rs#L46

warning: use of `.then_some(..).unwrap_or(..)` can be written more clearly with `if .. else ..`
  --> libcoap/src/crypto/psk/server.rs:46:37
   |
46 |         self.ctx.raw_cfg.ec_jpake = ec_jpake.then_some(1).unwrap_or(0);
   |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `if ec_jpake { 1 } else { 0 }`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#obfuscated_if_else
Raw output
libcoap/src/crypto/psk/server.rs:46:37:w:warning: use of `.then_some(..).unwrap_or(..)` can be written more clearly with `if .. else ..`
  --> libcoap/src/crypto/psk/server.rs:46:37
   |
46 |         self.ctx.raw_cfg.ec_jpake = ec_jpake.then_some(1).unwrap_or(0);
   |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `if ec_jpake { 1 } else { 0 }`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#obfuscated_if_else


__END__

Check warning on line 229 in libcoap/src/crypto/psk/server.rs

See this annotation in the file changed.

@github-actions github-actions / clippy (libcoap-rs)

[clippy (libcoap-rs)] libcoap/src/crypto/psk/server.rs#L229

warning: derefed type is same as origin
   --> libcoap/src/crypto/psk/server.rs:229:23
    |
229 |             .find(|k| k.identity().as_deref().is_some_and(|kid| kid == identity))
    |                       ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `k.identity()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_option_as_deref
Raw output
libcoap/src/crypto/psk/server.rs:229:23:w:warning: derefed type is same as origin
   --> libcoap/src/crypto/psk/server.rs:229:23
    |
229 |             .find(|k| k.identity().as_deref().is_some_and(|kid| kid == identity))
    |                       ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `k.identity()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_option_as_deref


__END__

Check warning on line 248 in libcoap/src/crypto/psk/server.rs

See this annotation in the file changed.

@github-actions github-actions / clippy (libcoap-rs)

[clippy (libcoap-rs)] libcoap/src/crypto/psk/server.rs#L248

warning: this call to `as_ref` does nothing
   --> libcoap/src/crypto/psk/server.rs:248:20
    |
248 |         let keys = self.as_ref();
    |                    ^^^^^^^^^^^^^ help: try: `self`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_asref
    = note: `#[warn(clippy::useless_asref)]` on by default
Raw output
libcoap/src/crypto/psk/server.rs:248:20:w:warning: this call to `as_ref` does nothing
   --> libcoap/src/crypto/psk/server.rs:248:20
    |
248 |         let keys = self.as_ref();
    |                    ^^^^^^^^^^^^^ help: try: `self`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_asref
    = note: `#[warn(clippy::useless_asref)]` on by default


__END__

Check warning on line 761 in libcoap/src/types.rs

See this annotation in the file changed.

@github-actions github-actions / clippy (libcoap-rs)

[clippy (libcoap-rs)] libcoap/src/types.rs#L761

warning: using `libc::strlen` on a `CString` or `CStr` value
   --> libcoap/src/types.rs:761:17
    |
761 |                 libc::strlen(uri.uri_str.0.as_ptr()),
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `uri.uri_str.0.as_bytes().len()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#strlen_on_c_strings
    = note: `#[warn(clippy::strlen_on_c_strings)]` on by default
Raw output
libcoap/src/types.rs:761:17:w:warning: using `libc::strlen` on a `CString` or `CStr` value
   --> libcoap/src/types.rs:761:17
    |
761 |                 libc::strlen(uri.uri_str.0.as_ptr()),
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `uri.uri_str.0.as_bytes().len()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#strlen_on_c_strings
    = note: `#[warn(clippy::strlen_on_c_strings)]` on by default


__END__