@@ -2,7 +2,7 @@ error: using `libc::strlen` on a `CString` value
22 --> tests/ui/strlen_on_c_strings.rs:10:13
33 |
44LL | let _ = unsafe { libc::strlen(cstring.as_ptr()) };
5- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `cstring.to_bytes().len ()`
5+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `cstring.count_bytes ()`
66 |
77 = note: `-D clippy::strlen-on-c-strings` implied by `-D warnings`
88 = help: to override `-D warnings` add `#[allow(clippy::strlen_on_c_strings)]`
@@ -11,55 +11,79 @@ error: using `libc::strlen` on a `CStr` value
1111 --> tests/ui/strlen_on_c_strings.rs:15:13
1212 |
1313LL | let _ = unsafe { libc::strlen(cstr.as_ptr()) };
14- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `cstr.to_bytes().len ()`
14+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `cstr.count_bytes ()`
1515
1616error: using `libc::strlen` on a `CStr` value
1717 --> tests/ui/strlen_on_c_strings.rs:18:13
1818 |
1919LL | let _ = unsafe { strlen(cstr.as_ptr()) };
20- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `cstr.to_bytes().len ()`
20+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `cstr.count_bytes ()`
2121
2222error: using `libc::strlen` on a `CStr` value
2323 --> tests/ui/strlen_on_c_strings.rs:22:22
2424 |
2525LL | let _ = unsafe { strlen((*pcstr).as_ptr()) };
26- | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `(*pcstr).to_bytes().len ()`
26+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `(*pcstr).count_bytes ()`
2727
2828error: using `libc::strlen` on a `CStr` value
2929 --> tests/ui/strlen_on_c_strings.rs:28:22
3030 |
3131LL | let _ = unsafe { strlen(unsafe_identity(cstr).as_ptr()) };
32- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `unsafe_identity(cstr).to_bytes().len ()`
32+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `unsafe_identity(cstr).count_bytes ()`
3333
3434error: using `libc::strlen` on a `CStr` value
3535 --> tests/ui/strlen_on_c_strings.rs:30:13
3636 |
3737LL | let _ = unsafe { strlen(unsafe { unsafe_identity(cstr) }.as_ptr()) };
38- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `unsafe { unsafe_identity(cstr) }.to_bytes().len ()`
38+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `unsafe { unsafe_identity(cstr) }.count_bytes ()`
3939
4040error: using `libc::strlen` on a `CStr` value
4141 --> tests/ui/strlen_on_c_strings.rs:34:22
4242 |
4343LL | let _ = unsafe { strlen(f(cstr).as_ptr()) };
44- | ^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `f(cstr).to_bytes().len ()`
44+ | ^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `f(cstr).count_bytes ()`
4545
4646error: using `libc::strlen` on a type that dereferences to `CStr`
4747 --> tests/ui/strlen_on_c_strings.rs:40:13
4848 |
4949LL | let _ = unsafe { libc::strlen(box_cstring.as_ptr()) };
50- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `box_cstring.to_bytes().len ()`
50+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `box_cstring.count_bytes ()`
5151
5252error: using `libc::strlen` on a type that dereferences to `CStr`
5353 --> tests/ui/strlen_on_c_strings.rs:42:13
5454 |
5555LL | let _ = unsafe { libc::strlen(box_cstr.as_ptr()) };
56- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `box_cstr.to_bytes().len ()`
56+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `box_cstr.count_bytes ()`
5757
5858error: using `libc::strlen` on a type that dereferences to `CStr`
5959 --> tests/ui/strlen_on_c_strings.rs:44:13
6060 |
6161LL | let _ = unsafe { libc::strlen(arc_cstring.as_ptr()) };
62- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `arc_cstring.to_bytes().len()`
62+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `arc_cstring.count_bytes()`
63+
64+ error: using `libc::strlen` on a `CStr` value
65+ --> tests/ui/strlen_on_c_strings.rs:51:13
66+ |
67+ LL | let _ = unsafe { libc::strlen(cstr.as_ptr()) };
68+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `cstr.to_bytes().len()`
69+
70+ error: using `libc::strlen` on a `CString` value
71+ --> tests/ui/strlen_on_c_strings.rs:55:13
72+ |
73+ LL | let _ = unsafe { libc::strlen(cstring.as_ptr()) };
74+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `cstring.to_bytes().len()`
75+
76+ error: using `libc::strlen` on a `CStr` value
77+ --> tests/ui/strlen_on_c_strings.rs:62:13
78+ |
79+ LL | let _ = unsafe { libc::strlen(cstr.as_ptr()) };
80+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `cstr.count_bytes()`
81+
82+ error: using `libc::strlen` on a `CString` value
83+ --> tests/ui/strlen_on_c_strings.rs:66:13
84+ |
85+ LL | let _ = unsafe { libc::strlen(cstring.as_ptr()) };
86+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `cstring.count_bytes()`
6387
64- error: aborting due to 10 previous errors
88+ error: aborting due to 14 previous errors
6589
0 commit comments