37 lines
1.3 KiB
Plaintext
37 lines
1.3 KiB
Plaintext
error: using `libc::strlen` on a `CString` or `CStr` value
|
|
--> $DIR/strlen_on_c_strings.rs:12:24
|
|
|
|
|
LL | let len = unsafe { libc::strlen(cstring.as_ptr()) };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: `-D clippy::strlen-on-c-strings` implied by `-D warnings`
|
|
help: try this (you might also need to get rid of `unsafe` block in some cases):
|
|
|
|
|
LL | let len = unsafe { cstring.as_bytes().len() };
|
|
| ~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
error: using `libc::strlen` on a `CString` or `CStr` value
|
|
--> $DIR/strlen_on_c_strings.rs:16:24
|
|
|
|
|
LL | let len = unsafe { libc::strlen(cstr.as_ptr()) };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
help: try this (you might also need to get rid of `unsafe` block in some cases):
|
|
|
|
|
LL | let len = unsafe { cstr.to_bytes().len() };
|
|
| ~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
error: using `libc::strlen` on a `CString` or `CStr` value
|
|
--> $DIR/strlen_on_c_strings.rs:18:24
|
|
|
|
|
LL | let len = unsafe { strlen(cstr.as_ptr()) };
|
|
| ^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
help: try this (you might also need to get rid of `unsafe` block in some cases):
|
|
|
|
|
LL | let len = unsafe { cstr.to_bytes().len() };
|
|
| ~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
error: aborting due to 3 previous errors
|
|
|