|
1 | 1 | error: using `libc::strlen` on a `CString` or `CStr` value |
2 | | - --> $DIR/strlen_on_c_strings.rs:12:15 |
| 2 | + --> $DIR/strlen_on_c_strings.rs:15:13 |
3 | 3 | | |
4 | | -LL | let len = unsafe { libc::strlen(cstring.as_ptr()) }; |
5 | | - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `cstring.as_bytes().len()` |
| 4 | +LL | let _ = unsafe { libc::strlen(cstring.as_ptr()) }; |
| 5 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `cstring.as_bytes().len()` |
6 | 6 | | |
7 | 7 | = note: `-D clippy::strlen-on-c-strings` implied by `-D warnings` |
8 | 8 |
|
9 | 9 | error: using `libc::strlen` on a `CString` or `CStr` value |
10 | | - --> $DIR/strlen_on_c_strings.rs:16:15 |
| 10 | + --> $DIR/strlen_on_c_strings.rs:19:13 |
11 | 11 | | |
12 | | -LL | let len = unsafe { libc::strlen(cstr.as_ptr()) }; |
13 | | - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `cstr.to_bytes().len()` |
| 12 | +LL | let _ = unsafe { libc::strlen(cstr.as_ptr()) }; |
| 13 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `cstr.to_bytes().len()` |
14 | 14 |
|
15 | 15 | error: using `libc::strlen` on a `CString` or `CStr` value |
16 | | - --> $DIR/strlen_on_c_strings.rs:18:15 |
| 16 | + --> $DIR/strlen_on_c_strings.rs:21:13 |
17 | 17 | | |
18 | | -LL | let len = unsafe { strlen(cstr.as_ptr()) }; |
19 | | - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `cstr.to_bytes().len()` |
| 18 | +LL | let _ = unsafe { strlen(cstr.as_ptr()) }; |
| 19 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `cstr.to_bytes().len()` |
20 | 20 |
|
21 | 21 | error: using `libc::strlen` on a `CString` or `CStr` value |
22 | | - --> $DIR/strlen_on_c_strings.rs:21:24 |
| 22 | + --> $DIR/strlen_on_c_strings.rs:24:22 |
23 | 23 | | |
24 | | -LL | let len = unsafe { strlen((*pcstr).as_ptr()) }; |
25 | | - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `(*pcstr).to_bytes().len()` |
| 24 | +LL | let _ = unsafe { strlen((*pcstr).as_ptr()) }; |
| 25 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `(*pcstr).to_bytes().len()` |
26 | 26 |
|
27 | 27 | error: using `libc::strlen` on a `CString` or `CStr` value |
28 | | - --> $DIR/strlen_on_c_strings.rs:26:24 |
| 28 | + --> $DIR/strlen_on_c_strings.rs:29:22 |
29 | 29 | | |
30 | | -LL | let len = unsafe { strlen(unsafe_identity(cstr).as_ptr()) }; |
31 | | - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unsafe_identity(cstr).to_bytes().len()` |
| 30 | +LL | let _ = unsafe { strlen(unsafe_identity(cstr).as_ptr()) }; |
| 31 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unsafe_identity(cstr).to_bytes().len()` |
32 | 32 |
|
33 | 33 | error: using `libc::strlen` on a `CString` or `CStr` value |
34 | | - --> $DIR/strlen_on_c_strings.rs:27:15 |
| 34 | + --> $DIR/strlen_on_c_strings.rs:30:13 |
35 | 35 | | |
36 | | -LL | let len = unsafe { strlen(unsafe { unsafe_identity(cstr) }.as_ptr()) }; |
37 | | - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unsafe { unsafe_identity(cstr) }.to_bytes().len()` |
| 36 | +LL | let _ = unsafe { strlen(unsafe { unsafe_identity(cstr) }.as_ptr()) }; |
| 37 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unsafe { unsafe_identity(cstr) }.to_bytes().len()` |
38 | 38 |
|
39 | 39 | error: using `libc::strlen` on a `CString` or `CStr` value |
40 | | - --> $DIR/strlen_on_c_strings.rs:30:24 |
| 40 | + --> $DIR/strlen_on_c_strings.rs:33:22 |
41 | 41 | | |
42 | | -LL | let len = unsafe { strlen(f(cstr).as_ptr()) }; |
43 | | - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `f(cstr).to_bytes().len()` |
| 42 | +LL | let _ = unsafe { strlen(f(cstr).as_ptr()) }; |
| 43 | + | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `f(cstr).to_bytes().len()` |
44 | 44 |
|
45 | 45 | error: aborting due to 7 previous errors |
46 | 46 |
|
0 commit comments