Skip to content

Add compile-time and runtime checks for feature availability #140

Add compile-time and runtime checks for feature availability

Add compile-time and runtime checks for feature availability #140

GitHub Actions / clippy (libcoap-rs) completed Aug 16, 2024 in 0s

reviewdog [clippy (libcoap-rs)] report

reported by reviewdog 🐶

Findings (1)

libcoap/src/context.rs|52 col 36| warning: unnecessary unsafe block
--> libcoap/src/context.rs:52:36
|
52 | COAP_STARTUP_ONCE.call_once(|| unsafe {
| ^^^^^^ unnecessary unsafe block
|
= note: #[warn(unused_unsafe)] on by default

Filtered Findings (10)

libcoap/src/context.rs|610 col 11| warning: unneeded sub cfg when there is only one condition
--> libcoap/src/context.rs:610:11
|
610 | #[cfg(all(feature = "dtls"))]
| ^^^^^^^^^^^^^^^^^^^^^ help: try: feature = "dtls"
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#non_minimal_cfg
= note: #[warn(clippy::non_minimal_cfg)] on by default
libcoap/src/prng.rs|18 col 16| warning: unused import: c_int
--> libcoap/src/prng.rs:18:16
|
18 | use std::ffi::{c_int, c_uint, c_void};
| ^^^^^
|
= note: #[warn(unused_imports)] on by default
libcoap/src/prng.rs|21 col 5| warning: unused import: libc::size_t
--> libcoap/src/prng.rs:21:5
|
21 | use libc::size_t;
| ^^^^^^^^^^^^
libcoap/src/prng.rs|25 col 46| warning: unused import: coap_set_prng
--> libcoap/src/prng.rs:25:46
|
25 | use libcoap_sys::{coap_prng, coap_prng_init, coap_set_prng};
| ^^^^^^^^^^^^^
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;
| ^^^^^^
|
= note: #[warn(dead_code)] on by default
libcoap/src/context.rs|122 col 17| warning: useless conversion to the same type: u32
--> libcoap/src/context.rs:122:17
|
122 | / (COAP_BLOCK_USE_LIBCOAP | COAP_BLOCK_SINGLE_BODY)
123 | | .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
libcoap/src/crypto.rs|145 col 53| warning: unnecessary map of the identity function
--> libcoap/src/crypto.rs:145:53
|
145 | .provide_raw_key_for_hint(provided_identity)
| _____________________________________________________^
146 | | .map(|v| v)
| |
^ help: remove the call to map
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_identity
= note: #[warn(clippy::map_identity)] on by default
libcoap/src/crypto.rs|173 col 49| warning: unnecessary map of the identity function
--> libcoap/src/crypto.rs:173:49
|
173 | .provide_raw_hint_for_sni(sni_value)
| ________________________^
174 | | .map(|v| (v))
| |
^ help: remove the call to map
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_identity
libcoap/src/session/client.rs|152 col 17| warning: casting raw pointers to the same type and constness is unnecessary (*mut libcoap_sys::coap_session_t -> *mut libcoap_sys::coap_session_t)
--> libcoap/src/session/client.rs:152:17
|
152 | session as *mut coap_session_t,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: session
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
= note: #[warn(clippy::unnecessary_cast)] on by default
libcoap/src/session/client.rs|186 col 17| warning: casting raw pointers to the same type and constness is unnecessary (*mut libcoap_sys::coap_session_t -> *mut libcoap_sys::coap_session_t)
--> libcoap/src/session/client.rs:186:17
|
186 | session as *mut coap_session_t,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: session
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Annotations

Check warning on line 52 in libcoap/src/context.rs

See this annotation in the file changed.

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

[clippy (libcoap-rs)] libcoap/src/context.rs#L52

warning: unnecessary `unsafe` block
  --> libcoap/src/context.rs:52:36
   |
52 |     COAP_STARTUP_ONCE.call_once(|| unsafe {
   |                                    ^^^^^^ unnecessary `unsafe` block
   |
   = note: `#[warn(unused_unsafe)]` on by default
Raw output
libcoap/src/context.rs:52:36:w:warning: unnecessary `unsafe` block
  --> libcoap/src/context.rs:52:36
   |
52 |     COAP_STARTUP_ONCE.call_once(|| unsafe {
   |                                    ^^^^^^ unnecessary `unsafe` block
   |
   = note: `#[warn(unused_unsafe)]` on by default


__END__