2024-02-08 19:24:42 +00:00
|
|
|
error: calling `CStr::new` with a byte string literal
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/manual_c_str_literals.rs:31:5
|
2024-02-08 19:24:42 +00:00
|
|
|
|
|
|
|
|
LL | CStr::from_bytes_with_nul(b"foo\0");
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use a `c""` literal: `c"foo"`
|
|
|
|
|
|
|
|
|
= note: `-D clippy::manual-c-str-literals` implied by `-D warnings`
|
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::manual_c_str_literals)]`
|
|
|
|
|
|
|
|
error: calling `CStr::new` with a byte string literal
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/manual_c_str_literals.rs:35:5
|
2024-02-08 19:24:42 +00:00
|
|
|
|
|
|
|
|
LL | CStr::from_bytes_with_nul(b"foo\0");
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use a `c""` literal: `c"foo"`
|
|
|
|
|
|
|
|
error: calling `CStr::new` with a byte string literal
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/manual_c_str_literals.rs:36:5
|
2024-02-08 19:24:42 +00:00
|
|
|
|
|
|
|
|
LL | CStr::from_bytes_with_nul(b"foo\x00");
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use a `c""` literal: `c"foo"`
|
|
|
|
|
|
|
|
error: calling `CStr::new` with a byte string literal
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/manual_c_str_literals.rs:37:5
|
2024-02-08 19:24:42 +00:00
|
|
|
|
|
|
|
|
LL | CStr::from_bytes_with_nul(b"foo\0").unwrap();
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use a `c""` literal: `c"foo"`
|
|
|
|
|
|
|
|
error: calling `CStr::new` with a byte string literal
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/manual_c_str_literals.rs:38:5
|
2024-02-08 19:24:42 +00:00
|
|
|
|
|
|
|
|
LL | CStr::from_bytes_with_nul(b"foo\\0sdsd\0").unwrap();
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use a `c""` literal: `c"foo\\0sdsd"`
|
|
|
|
|
|
|
|
error: calling `CStr::from_ptr` with a byte string literal
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/manual_c_str_literals.rs:43:14
|
2024-02-08 19:24:42 +00:00
|
|
|
|
|
|
|
|
LL | unsafe { CStr::from_ptr(b"foo\0".as_ptr().cast()) };
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use a `c""` literal: `c"foo"`
|
|
|
|
|
|
|
|
error: calling `CStr::from_ptr` with a byte string literal
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/manual_c_str_literals.rs:44:14
|
2024-02-08 19:24:42 +00:00
|
|
|
|
|
|
|
|
LL | unsafe { CStr::from_ptr(b"foo\0".as_ptr() as *const _) };
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use a `c""` literal: `c"foo"`
|
|
|
|
|
|
|
|
error: manually constructing a nul-terminated string
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/manual_c_str_literals.rs:45:23
|
2024-02-08 19:24:42 +00:00
|
|
|
|
|
|
|
|
LL | let _: *const _ = b"foo\0".as_ptr();
|
|
|
|
| ^^^^^^^^ help: use a `c""` literal: `c"foo"`
|
|
|
|
|
|
|
|
error: manually constructing a nul-terminated string
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/manual_c_str_literals.rs:46:23
|
2024-02-08 19:24:42 +00:00
|
|
|
|
|
|
|
|
LL | let _: *const _ = "foo\0".as_ptr();
|
|
|
|
| ^^^^^^^ help: use a `c""` literal: `c"foo"`
|
|
|
|
|
|
|
|
error: manually constructing a nul-terminated string
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/manual_c_str_literals.rs:49:23
|
2024-02-08 19:24:42 +00:00
|
|
|
|
|
|
|
|
LL | let _: *const _ = b"foo\0".as_ptr().cast::<i8>();
|
|
|
|
| ^^^^^^^^ help: use a `c""` literal: `c"foo"`
|
|
|
|
|
|
|
|
error: manually constructing a nul-terminated string
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/manual_c_str_literals.rs:52:13
|
2024-02-08 19:24:42 +00:00
|
|
|
|
|
|
|
|
LL | let _ = "电脑\\\0".as_ptr();
|
|
|
|
| ^^^^^^^^^^ help: use a `c""` literal: `c"电脑\\"`
|
|
|
|
|
|
|
|
error: manually constructing a nul-terminated string
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/manual_c_str_literals.rs:53:13
|
2024-02-08 19:24:42 +00:00
|
|
|
|
|
|
|
|
LL | let _ = "电脑\0".as_ptr();
|
|
|
|
| ^^^^^^^^ help: use a `c""` literal: `c"电脑"`
|
|
|
|
|
|
|
|
error: manually constructing a nul-terminated string
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/manual_c_str_literals.rs:54:13
|
2024-02-08 19:24:42 +00:00
|
|
|
|
|
|
|
|
LL | let _ = "电脑\x00".as_ptr();
|
|
|
|
| ^^^^^^^^^^ help: use a `c""` literal: `c"电脑"`
|
|
|
|
|
|
|
|
error: aborting due to 13 previous errors
|
|
|
|
|