]> git.lizzy.rs Git - rust.git/blob - tests/ui/strlen_on_c_strings.stderr
Fix `strlen_on_c_strings` when not used with a full path
[rust.git] / tests / ui / strlen_on_c_strings.stderr
1 error: using `libc::strlen` on a `CString` or `CStr` value
2   --> $DIR/strlen_on_c_strings.rs:12:24
3    |
4 LL |     let len = unsafe { libc::strlen(cstring.as_ptr()) };
5    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6    |
7    = note: `-D clippy::strlen-on-c-strings` implied by `-D warnings`
8 help: try this (you might also need to get rid of `unsafe` block in some cases):
9    |
10 LL |     let len = unsafe { cstring.as_bytes().len() };
11    |                        ~~~~~~~~~~~~~~~~~~~~~~~~
12
13 error: using `libc::strlen` on a `CString` or `CStr` value
14   --> $DIR/strlen_on_c_strings.rs:16:24
15    |
16 LL |     let len = unsafe { libc::strlen(cstr.as_ptr()) };
17    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
18    |
19 help: try this (you might also need to get rid of `unsafe` block in some cases):
20    |
21 LL |     let len = unsafe { cstr.to_bytes().len() };
22    |                        ~~~~~~~~~~~~~~~~~~~~~
23
24 error: using `libc::strlen` on a `CString` or `CStr` value
25   --> $DIR/strlen_on_c_strings.rs:18:24
26    |
27 LL |     let len = unsafe { strlen(cstr.as_ptr()) };
28    |                        ^^^^^^^^^^^^^^^^^^^^^
29    |
30 help: try this (you might also need to get rid of `unsafe` block in some cases):
31    |
32 LL |     let len = unsafe { cstr.to_bytes().len() };
33    |                        ~~~~~~~~~~~~~~~~~~~~~
34
35 error: aborting due to 3 previous errors
36