Skip to content

Commit e5f26da

Browse files
author
Xing Xue
committed
Addressed comment: use explicit 'cast::<c_char>()'.
1 parent a2408fc commit e5f26da

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

ctest-next/templates/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ mod generated_tests {
5656
let val = {{ ident }};
5757
unsafe {
5858
let ptr = *__test_const_{{ ident }}();
59-
let val = CStr::from_ptr(ptr as _);
59+
let val = CStr::from_ptr(ptr.cast::<c_char>());
6060
let val = val.to_str().expect("const {{ ident }} not utf8");
6161
let c = ::std::ffi::CStr::from_ptr(ptr as *const _);
6262
let c = c.to_str().expect("const {{ ident }} not utf8");

ctest-next/tests/input/simple.out.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ mod generated_tests {
4949
let val = A;
5050
unsafe {
5151
let ptr = *__test_const_A();
52-
let val = CStr::from_ptr(ptr as _);
52+
let val = CStr::from_ptr(ptr.cast::<c_char>());
5353
let val = val.to_str().expect("const A not utf8");
5454
let c = ::std::ffi::CStr::from_ptr(ptr as *const _);
5555
let c = c.to_str().expect("const A not utf8");

0 commit comments

Comments
 (0)