Skip to content

Commit 7804216

Browse files
committed
Use to_rust_string in unlink
1 parent ea698aa commit 7804216

2 files changed

Lines changed: 2 additions & 14 deletions

File tree

rules/unistd/tgt_refcount.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@
44
use libcc2rs::*;
55

66
fn f4(a0: Ptr<u8>) -> i32 {
7-
match nix::unistd::unlink(
8-
::std::ffi::CString::new(a0.to_c_string_iterator().collect::<Vec<u8>>())
9-
.unwrap()
10-
.as_c_str(),
11-
) {
7+
match nix::unistd::unlink(a0.to_rust_string().as_str()) {
128
Ok(()) => 0,
139
Err(__e) => {
1410
libcc2rs::cpp2rust_errno().write(__e as i32);

tests/unit/out/refcount/stdcopy_ostream.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,7 @@ fn main_0() -> i32 {
2929
);
3030
(*ofs.borrow_mut()).try_clone().unwrap()
3131
};
32-
match nix::unistd::unlink(
33-
::std::ffi::CString::new(
34-
(file.as_pointer() as Ptr<u8>)
35-
.to_c_string_iterator()
36-
.collect::<Vec<u8>>(),
37-
)
38-
.unwrap()
39-
.as_c_str(),
40-
) {
32+
match nix::unistd::unlink((file.as_pointer() as Ptr<u8>).to_rust_string().as_str()) {
4133
Ok(()) => 0,
4234
Err(__e) => {
4335
libcc2rs::cpp2rust_errno().write(__e as i32);

0 commit comments

Comments
 (0)