Skip to content

Update libcoap to 4.3.5, bump dependencies, improve linking (incl. ESP32) #97

Update libcoap to 4.3.5, bump dependencies, improve linking (incl. ESP32)

Update libcoap to 4.3.5, bump dependencies, improve linking (incl. ESP32) #97

GitHub Actions / clippy (libcoap-sys) completed Jun 27, 2024 in 0s

reviewdog [clippy (libcoap-sys)] report

reported by reviewdog 🐶

Findings (10)

libcoap-sys/build.rs|18 col 5| warning: unused import: std::collections::HashMap
--> libcoap-sys/build.rs:18:5
|
18 | use std::collections::HashMap;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: #[warn(unused_imports)] on by default
libcoap-sys/build.rs|19 col 16| warning: unused imports: CStr, CString
--> libcoap-sys/build.rs:19:16
|
19 | use std::ffi::{CStr, CString};
| ^^^^ ^^^^^^^
libcoap-sys/build.rs|20 col 23| warning: unused import: Formatter
--> libcoap-sys/build.rs:20:23
|
20 | use std::fmt::{Debug, Formatter};
| ^^^^^^^^^
libcoap-sys/build.rs|89 col 5| warning: unnecessary unsafe block
--> libcoap-sys/build.rs:89:5
|
89 | unsafe { env::set_var("PATH", embuild_env) };
| ^^^^^^ unnecessary unsafe block
|
= note: #[warn(unused_unsafe)] on by default
libcoap-sys/build.rs|445 col 9| warning: unnecessary unsafe block
--> libcoap-sys/build.rs:445:9
|
445 | unsafe {
| ^^^^^^ unnecessary unsafe block
libcoap-sys/build.rs|592 col 5| warning: unnecessary unsafe block
--> libcoap-sys/build.rs:592:5
|
592 | unsafe {
| ^^^^^^ unnecessary unsafe block
libcoap-sys/build.rs|38 col 9| warning: you seem to be trying to use match for an equality check. Consider using if
--> libcoap-sys/build.rs:38:9
|
38 | / match name {
39 | | "PACKAGE_VERSION" => {
40 | | let version_str = String::from_utf8_lossy(value);
41 | | println!("cargo:rustc-cfg=libcoap_version="{}"", version_str.as_ref());
... |
49 | | _ => {},
50 | | }
| |________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
= note: #[warn(clippy::single_match)] on by default
help: try
|
38 ~ if name == "PACKAGE_VERSION" {
39 + let version_str = String::from_utf8_lossy(value);
40 + println!("cargo:rustc-cfg=libcoap_version="{}"", version_str.as_ref());
41 + let version = Version::from(version_str.as_ref()).unwrap();
42 + match version.compare(Version::from("4.3.4").unwrap()) {
43 + Cmp::Lt | Cmp::Eq => println!("cargo:rustc-cfg=inlined_coap_send_rst"),
44 + _ => {},
45 + }
46 + self.version.replace(version.to_string());
47 + }
|
libcoap-sys/build.rs|451 col 65| warning: use of unwrap_or_else to construct default value
--> libcoap-sys/build.rs:451:65
|
451 | orig_pkg_config.as_ref().map(String::clone).unwrap_or_else(String::new)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: unwrap_or_default()
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default
= note: #[warn(clippy::unwrap_or_default)] on by default
libcoap-sys/build.rs|451 col 21| warning: this call to as_ref.map(...) does nothing
--> libcoap-sys/build.rs:451:21
|
451 | orig_pkg_config.as_ref().map(String::clone).unwrap_or_else(String::new)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: orig_pkg_config.clone()
|
= 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-sys/build.rs|486 col 28| warning: redundant pattern matching, consider using is_some()
--> libcoap-sys/build.rs:486:28
|
486 | if let Some(
) = env::var_os("DEP_MBEDTLS_INCLUDE") {
| -------^^^^^^^------------------------------------- help: try: if env::var_os("DEP_MBEDTLS_INCLUDE").is_some()
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching
= note: #[warn(clippy::redundant_pattern_matching)] on by default

Filtered Findings (1)

libcoap-sys/build.rs|61 col 1| warning: direct implementation of ToString
--> libcoap-sys/build.rs:61:1
|
61 | / impl ToString for DtlsBackend {
62 | | fn to_string(&self) -> String {
63 | | match self {
64 | | DtlsBackend::GnuTls => "gnutls",
... |
70 | | }
71 | | }
| |_^
|
= help: prefer implementing Display instead
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#to_string_trait_impl
= note: #[warn(clippy::to_string_trait_impl)] on by default

Annotations

Check warning on line 18 in libcoap-sys/build.rs

See this annotation in the file changed.

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

[clippy (libcoap-sys)] libcoap-sys/build.rs#L18

warning: unused import: `std::collections::HashMap`
  --> libcoap-sys/build.rs:18:5
   |
18 | use std::collections::HashMap;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(unused_imports)]` on by default
Raw output
libcoap-sys/build.rs:18:5:w:warning: unused import: `std::collections::HashMap`
  --> libcoap-sys/build.rs:18:5
   |
18 | use std::collections::HashMap;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(unused_imports)]` on by default


__END__

Check warning on line 19 in libcoap-sys/build.rs

See this annotation in the file changed.

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

[clippy (libcoap-sys)] libcoap-sys/build.rs#L19

warning: unused imports: `CStr`, `CString`
  --> libcoap-sys/build.rs:19:16
   |
19 | use std::ffi::{CStr, CString};
   |                ^^^^  ^^^^^^^
Raw output
libcoap-sys/build.rs:19:16:w:warning: unused imports: `CStr`, `CString`
  --> libcoap-sys/build.rs:19:16
   |
19 | use std::ffi::{CStr, CString};
   |                ^^^^  ^^^^^^^


__END__

Check warning on line 20 in libcoap-sys/build.rs

See this annotation in the file changed.

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

[clippy (libcoap-sys)] libcoap-sys/build.rs#L20

warning: unused import: `Formatter`
  --> libcoap-sys/build.rs:20:23
   |
20 | use std::fmt::{Debug, Formatter};
   |                       ^^^^^^^^^
Raw output
libcoap-sys/build.rs:20:23:w:warning: unused import: `Formatter`
  --> libcoap-sys/build.rs:20:23
   |
20 | use std::fmt::{Debug, Formatter};
   |                       ^^^^^^^^^


__END__

Check warning on line 89 in libcoap-sys/build.rs

See this annotation in the file changed.

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

[clippy (libcoap-sys)] libcoap-sys/build.rs#L89

warning: unnecessary `unsafe` block
  --> libcoap-sys/build.rs:89:5
   |
89 |     unsafe { env::set_var("PATH", embuild_env) };
   |     ^^^^^^ unnecessary `unsafe` block
   |
   = note: `#[warn(unused_unsafe)]` on by default
Raw output
libcoap-sys/build.rs:89:5:w:warning: unnecessary `unsafe` block
  --> libcoap-sys/build.rs:89:5
   |
89 |     unsafe { env::set_var("PATH", embuild_env) };
   |     ^^^^^^ unnecessary `unsafe` block
   |
   = note: `#[warn(unused_unsafe)]` on by default


__END__

Check warning on line 445 in libcoap-sys/build.rs

See this annotation in the file changed.

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

[clippy (libcoap-sys)] libcoap-sys/build.rs#L445

warning: unnecessary `unsafe` block
   --> libcoap-sys/build.rs:445:9
    |
445 |         unsafe {
    |         ^^^^^^ unnecessary `unsafe` block
Raw output
libcoap-sys/build.rs:445:9:w:warning: unnecessary `unsafe` block
   --> libcoap-sys/build.rs:445:9
    |
445 |         unsafe {
    |         ^^^^^^ unnecessary `unsafe` block


__END__

Check warning on line 592 in libcoap-sys/build.rs

See this annotation in the file changed.

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

[clippy (libcoap-sys)] libcoap-sys/build.rs#L592

warning: unnecessary `unsafe` block
   --> libcoap-sys/build.rs:592:5
    |
592 |     unsafe {
    |     ^^^^^^ unnecessary `unsafe` block
Raw output
libcoap-sys/build.rs:592:5:w:warning: unnecessary `unsafe` block
   --> libcoap-sys/build.rs:592:5
    |
592 |     unsafe {
    |     ^^^^^^ unnecessary `unsafe` block


__END__

Check warning on line 38 in libcoap-sys/build.rs

See this annotation in the file changed.

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

[clippy (libcoap-sys)] libcoap-sys/build.rs#L38

warning: you seem to be trying to use `match` for an equality check. Consider using `if`
  --> libcoap-sys/build.rs:38:9
   |
38 | /         match name {
39 | |             "PACKAGE_VERSION" => {
40 | |                 let version_str = String::from_utf8_lossy(value);
41 | |                 println!("cargo:rustc-cfg=libcoap_version=\"{}\"", version_str.as_ref());
...  |
49 | |             _ => {},
50 | |         }
   | |_________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
   = note: `#[warn(clippy::single_match)]` on by default
help: try
   |
38 ~         if name == "PACKAGE_VERSION" {
39 +             let version_str = String::from_utf8_lossy(value);
40 +             println!("cargo:rustc-cfg=libcoap_version=\"{}\"", version_str.as_ref());
41 +             let version = Version::from(version_str.as_ref()).unwrap();
42 +             match version.compare(Version::from("4.3.4").unwrap()) {
43 +                 Cmp::Lt | Cmp::Eq => println!("cargo:rustc-cfg=inlined_coap_send_rst"),
44 +                 _ => {},
45 +             }
46 +             self.version.replace(version.to_string());
47 +         }
   |
Raw output
libcoap-sys/build.rs:38:9:w:warning: you seem to be trying to use `match` for an equality check. Consider using `if`
  --> libcoap-sys/build.rs:38:9
   |
38 | /         match name {
39 | |             "PACKAGE_VERSION" => {
40 | |                 let version_str = String::from_utf8_lossy(value);
41 | |                 println!("cargo:rustc-cfg=libcoap_version=\"{}\"", version_str.as_ref());
...  |
49 | |             _ => {},
50 | |         }
   | |_________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
   = note: `#[warn(clippy::single_match)]` on by default
help: try
   |
38 ~         if name == "PACKAGE_VERSION" {
39 +             let version_str = String::from_utf8_lossy(value);
40 +             println!("cargo:rustc-cfg=libcoap_version=\"{}\"", version_str.as_ref());
41 +             let version = Version::from(version_str.as_ref()).unwrap();
42 +             match version.compare(Version::from("4.3.4").unwrap()) {
43 +                 Cmp::Lt | Cmp::Eq => println!("cargo:rustc-cfg=inlined_coap_send_rst"),
44 +                 _ => {},
45 +             }
46 +             self.version.replace(version.to_string());
47 +         }
   |


__END__

Check warning on line 451 in libcoap-sys/build.rs

See this annotation in the file changed.

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

[clippy (libcoap-sys)] libcoap-sys/build.rs#L451

warning: use of `unwrap_or_else` to construct default value
   --> libcoap-sys/build.rs:451:65
    |
451 |                     orig_pkg_config.as_ref().map(String::clone).unwrap_or_else(String::new)
    |                                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default
    = note: `#[warn(clippy::unwrap_or_default)]` on by default
Raw output
libcoap-sys/build.rs:451:65:w:warning: use of `unwrap_or_else` to construct default value
   --> libcoap-sys/build.rs:451:65
    |
451 |                     orig_pkg_config.as_ref().map(String::clone).unwrap_or_else(String::new)
    |                                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default
    = note: `#[warn(clippy::unwrap_or_default)]` on by default


__END__

Check warning on line 451 in libcoap-sys/build.rs

See this annotation in the file changed.

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

[clippy (libcoap-sys)] libcoap-sys/build.rs#L451

warning: this call to `as_ref.map(...)` does nothing
   --> libcoap-sys/build.rs:451:21
    |
451 |                     orig_pkg_config.as_ref().map(String::clone).unwrap_or_else(String::new)
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `orig_pkg_config.clone()`
    |
    = 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-sys/build.rs:451:21:w:warning: this call to `as_ref.map(...)` does nothing
   --> libcoap-sys/build.rs:451:21
    |
451 |                     orig_pkg_config.as_ref().map(String::clone).unwrap_or_else(String::new)
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `orig_pkg_config.clone()`
    |
    = 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 486 in libcoap-sys/build.rs

See this annotation in the file changed.

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

[clippy (libcoap-sys)] libcoap-sys/build.rs#L486

warning: redundant pattern matching, consider using `is_some()`
   --> libcoap-sys/build.rs:486:28
    |
486 |                     if let Some(_) = env::var_os("DEP_MBEDTLS_INCLUDE") {
    |                     -------^^^^^^^------------------------------------- help: try: `if env::var_os("DEP_MBEDTLS_INCLUDE").is_some()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching
    = note: `#[warn(clippy::redundant_pattern_matching)]` on by default
Raw output
libcoap-sys/build.rs:486:28:w:warning: redundant pattern matching, consider using `is_some()`
   --> libcoap-sys/build.rs:486:28
    |
486 |                     if let Some(_) = env::var_os("DEP_MBEDTLS_INCLUDE") {
    |                     -------^^^^^^^------------------------------------- help: try: `if env::var_os("DEP_MBEDTLS_INCLUDE").is_some()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching
    = note: `#[warn(clippy::redundant_pattern_matching)]` on by default


__END__