Skip to content

Commit a2408fc

Browse files
author
Xing Xue
committed
Use "as _" for type cast.
1 parent bf70389 commit a2408fc

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 = unsafe {CStr::from_ptr(ptr)};
59+
let val = CStr::from_ptr(ptr as _);
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 = unsafe {CStr::from_ptr(ptr)};
52+
let val = CStr::from_ptr(ptr as _);
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)