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 clippy warnings #939

Merged
merged 8 commits into from
Mar 5, 2025
Merged

Fix clippy warnings #939

merged 8 commits into from
Mar 5, 2025

Conversation

Mallets
Copy link
Member

@Mallets Mallets commented Mar 4, 2025

Fix clippy warnings.

What is left out:

$ cargo +stable clippy --all-features --all-targets --fix --lib -p zenoh-c --allow-dirty
   Compiling zenoh-c v1.2.1 (/Users/luca/Repository/eclipse-zenoh-c)
warning: manually constructing a nul-terminated string
  --> src/config.rs:33:53
   |
33 | pub static Z_CONFIG_MODE_KEY: &c_char = unsafe { &*(b"mode\0".as_ptr() as *const c_char) };
   |                                                     ^^^^^^^^^ help: use a `c""` literal: `c"mode"`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_c_str_literals
   = note: `#[warn(clippy::manual_c_str_literals)]` on by default

warning: manually constructing a nul-terminated string
  --> src/config.rs:36:17
   |
36 |     unsafe { &*(b"connect/endpoints\0".as_ptr() as *const c_char) };
   |                 ^^^^^^^^^^^^^^^^^^^^^^ help: use a `c""` literal: `c"connect/endpoints"`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_c_str_literals

warning: manually constructing a nul-terminated string
  --> src/config.rs:39:17
   |
39 |     unsafe { &*(b"listen/endpoints\0".as_ptr() as *const c_char) };
   |                 ^^^^^^^^^^^^^^^^^^^^^ help: use a `c""` literal: `c"listen/endpoints"`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_c_str_literals

warning: manually constructing a nul-terminated string
  --> src/config.rs:42:17
   |
42 |     unsafe { &*(b"transport/auth/usrpwd/user\0".as_ptr() as *const c_char) };
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use a `c""` literal: `c"transport/auth/usrpwd/user"`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_c_str_literals

warning: manually constructing a nul-terminated string
  --> src/config.rs:45:17
   |
45 |     unsafe { &*(b"transport/auth/usrpwd/password\0".as_ptr() as *const c_char) };
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use a `c""` literal: `c"transport/auth/usrpwd/password"`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_c_str_literals

warning: manually constructing a nul-terminated string
  --> src/config.rs:48:17
   |
48 |     unsafe { &*(b"scouting/multicast/enabled\0".as_ptr() as *const c_char) };
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use a `c""` literal: `c"scouting/multicast/enabled"`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_c_str_literals

warning: manually constructing a nul-terminated string
  --> src/config.rs:51:17
   |
51 |     unsafe { &*(b"scouting/multicast/interface\0".as_ptr() as *const c_char) };
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use a `c""` literal: `c"scouting/multicast/interface"`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_c_str_literals

warning: manually constructing a nul-terminated string
  --> src/config.rs:54:17
   |
54 |     unsafe { &*(b"scouting/multicast/address\0".as_ptr() as *const c_char) };
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use a `c""` literal: `c"scouting/multicast/address"`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_c_str_literals

warning: manually constructing a nul-terminated string
  --> src/config.rs:57:17
   |
57 |     unsafe { &*(b"scouting/timeout\0".as_ptr() as *const c_char) };
   |                 ^^^^^^^^^^^^^^^^^^^^^ help: use a `c""` literal: `c"scouting/timeout"`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_c_str_literals

warning: manually constructing a nul-terminated string
  --> src/config.rs:60:17
   |
60 |     unsafe { &*(b"scouting/delay\0".as_ptr() as *const c_char) };
   |                 ^^^^^^^^^^^^^^^^^^^ help: use a `c""` literal: `c"scouting/delay"`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_c_str_literals

warning: manually constructing a nul-terminated string
  --> src/config.rs:63:17
   |
63 |     unsafe { &*(b"timestamping/enabled\0".as_ptr() as *const c_char) };
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use a `c""` literal: `c"timestamping/enabled"`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_c_str_literals

warning: manually constructing a nul-terminated string
  --> src/config.rs:66:17
   |
66 |     unsafe { &*(b"transport/shared_memory/enabled\0".as_ptr() as *const c_char) };
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use a `c""` literal: `c"transport/shared_memory/enabled"`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_c_str_literals

warning: `zenoh-c` (lib test) generated 12 warnings
warning: `zenoh-c` (lib) generated 12 warnings (12 duplicates)

In order to fix the above problem, p-avital/validated-struct-macros-rs#2 should be merged and validated-struct-macros-rs be released with updated dependencies.

@Mallets Mallets added the internal Changes not included in the changelog label Mar 4, 2025
@Mallets Mallets marked this pull request as draft March 4, 2025 16:33
@Mallets Mallets marked this pull request as ready for review March 4, 2025 16:35
@Mallets Mallets requested a review from DenisBiryukov91 March 5, 2025 10:12
@Mallets Mallets merged commit c8df586 into main Mar 5, 2025
37 checks passed
@Mallets Mallets deleted the fix/clippy branch March 5, 2025 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal Changes not included in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants