diff options
| author | Josh Stone <jistone@redhat.com> | 2024-08-20 14:04:48 -0700 |
|---|---|---|
| committer | Josh Stone <jistone@redhat.com> | 2024-08-20 14:04:48 -0700 |
| commit | e424e7fcaacf1bd26584a2ecf50299c0058fbba5 (patch) | |
| tree | 8b91b5746074500b9aab27122bce74464057f260 /library/std/src/sys | |
| parent | a971212545766fdfe0dd68e5d968133f79944a19 (diff) | |
| download | rust-e424e7fcaacf1bd26584a2ecf50299c0058fbba5.tar.gz rust-e424e7fcaacf1bd26584a2ecf50299c0058fbba5.zip | |
Avoid extra `cast()`s after `CStr::as_ptr()`
These used to be `&str` literals that did need a pointer cast, but that became a no-op after switching to `c""` literals in #118566.
Diffstat (limited to 'library/std/src/sys')
| -rw-r--r-- | library/std/src/sys/pal/unix/mod.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/library/std/src/sys/pal/unix/mod.rs b/library/std/src/sys/pal/unix/mod.rs index b62129f4cdd..10df3306f92 100644 --- a/library/std/src/sys/pal/unix/mod.rs +++ b/library/std/src/sys/pal/unix/mod.rs @@ -116,7 +116,7 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) { if pfd.revents & libc::POLLNVAL == 0 { continue; } - if open64(c"/dev/null".as_ptr().cast(), libc::O_RDWR, 0) == -1 { + if open64(c"/dev/null".as_ptr(), libc::O_RDWR, 0) == -1 { // If the stream is closed but we failed to reopen it, abort the // process. Otherwise we wouldn't preserve the safety of // operations on the corresponding Rust object Stdin, Stdout, or @@ -147,7 +147,7 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) { use crate::sys::os::errno; for fd in 0..3 { if libc::fcntl(fd, libc::F_GETFD) == -1 && errno() == libc::EBADF { - if open64(c"/dev/null".as_ptr().cast(), libc::O_RDWR, 0) == -1 { + if open64(c"/dev/null".as_ptr(), libc::O_RDWR, 0) == -1 { // If the stream is closed but we failed to reopen it, abort the // process. Otherwise we wouldn't preserve the safety of // operations on the corresponding Rust object Stdin, Stdout, or |
