mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 07:00:55 +00:00
47 lines
2 KiB
Text
47 lines
2 KiB
Text
error: using `libc::strlen` on a `CString` or `CStr` value
|
|
--> tests/ui/strlen_on_c_strings.rs:13:13
|
|
|
|
|
LL | let _ = unsafe { libc::strlen(cstring.as_ptr()) };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `cstring.as_bytes().len()`
|
|
|
|
|
= note: `-D clippy::strlen-on-c-strings` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::strlen_on_c_strings)]`
|
|
|
|
error: using `libc::strlen` on a `CString` or `CStr` value
|
|
--> tests/ui/strlen_on_c_strings.rs:17:13
|
|
|
|
|
LL | let _ = unsafe { libc::strlen(cstr.as_ptr()) };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `cstr.to_bytes().len()`
|
|
|
|
error: using `libc::strlen` on a `CString` or `CStr` value
|
|
--> tests/ui/strlen_on_c_strings.rs:19:13
|
|
|
|
|
LL | let _ = unsafe { strlen(cstr.as_ptr()) };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `cstr.to_bytes().len()`
|
|
|
|
error: using `libc::strlen` on a `CString` or `CStr` value
|
|
--> tests/ui/strlen_on_c_strings.rs:22:22
|
|
|
|
|
LL | let _ = unsafe { strlen((*pcstr).as_ptr()) };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(*pcstr).to_bytes().len()`
|
|
|
|
error: using `libc::strlen` on a `CString` or `CStr` value
|
|
--> tests/ui/strlen_on_c_strings.rs:27:22
|
|
|
|
|
LL | let _ = unsafe { strlen(unsafe_identity(cstr).as_ptr()) };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unsafe_identity(cstr).to_bytes().len()`
|
|
|
|
error: using `libc::strlen` on a `CString` or `CStr` value
|
|
--> tests/ui/strlen_on_c_strings.rs:28:13
|
|
|
|
|
LL | let _ = unsafe { strlen(unsafe { unsafe_identity(cstr) }.as_ptr()) };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unsafe { unsafe_identity(cstr) }.to_bytes().len()`
|
|
|
|
error: using `libc::strlen` on a `CString` or `CStr` value
|
|
--> tests/ui/strlen_on_c_strings.rs:31:22
|
|
|
|
|
LL | let _ = unsafe { strlen(f(cstr).as_ptr()) };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `f(cstr).to_bytes().len()`
|
|
|
|
error: aborting due to 7 previous errors
|
|
|