Cleanup sys module to match house style · model-checking/verify-rust-std@85e4ba0 (original) (raw)

6 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@ use crate::io::{Read, Write};
2 2 use crate::pipe::pipe;
3 3
4 4 #[test]
5 +#[cfg(all(windows, unix, not(miri)))]
5 6 fn pipe_creation_clone_and_rw() {
6 7 let (rx, tx) = pipe().unwrap();
7 8
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
1 +#![forbid(unsafe_op_in_unsafe_fn)]
2 +
1 3 cfg_if::cfg_if! {
2 4 if #[cfg(unix)] {
3 5 mod unix;
4 -pub(crate) use unix::{AnonPipe, pipe};
5 -
6 - #[cfg(all(test, not(miri)))]
7 -mod tests;
6 +pub use unix::{AnonPipe, pipe};
8 7 } else if #[cfg(windows)] {
9 8 mod windows;
10 -pub(crate) use windows::{AnonPipe, pipe};
11 -
12 - #[cfg(all(test, not(miri)))]
13 -mod tests;
9 +pub use windows::{AnonPipe, pipe};
14 10 } else {
15 11 mod unsupported;
16 -pub(crate) use unsupported::{AnonPipe, pipe};
12 +pub use unsupported::{AnonPipe, pipe};
17 13 }
18 14 }
Original file line number Diff line number Diff line change
@@ -6,10 +6,10 @@ use crate::sys::fd::FileDesc;
6 6 use crate::sys::pipe::anon_pipe;
7 7 use crate::sys_common::{FromInner, IntoInner};
8 8
9 -pub(crate) type AnonPipe = FileDesc;
9 +pub type AnonPipe = FileDesc;
10 10
11 11 #[inline]
12 -pub(crate) fn pipe() -> io::Result<(AnonPipe, AnonPipe)> {
12 +pub fn pipe() -> io::Result<(AnonPipe, AnonPipe)> {
13 13 anon_pipe().map(|(rx, wx)
14 14 }
15 15
@@ -34,7 +34,7 @@ impl From for OwnedFd {
34 34 #[unstable(feature = "anonymous_pipe", issue = "127154")]
35 35 impl FromRawFd for PipeReader {
36 36 unsafe fn from_raw_fd(raw_fd: RawFd) -> Self {
37 -Self(FileDesc::from_raw_fd(raw_fd))
37 +unsafe { Self(FileDesc::from_raw_fd(raw_fd)) }
38 38 }
39 39 }
40 40 #[unstable(feature = "anonymous_pipe", issue = "127154")]
@@ -71,7 +71,7 @@ impl From for OwnedFd {
71 71 #[unstable(feature = "anonymous_pipe", issue = "127154")]
72 72 impl FromRawFd for PipeWriter {
73 73 unsafe fn from_raw_fd(raw_fd: RawFd) -> Self {
74 -Self(FileDesc::from_raw_fd(raw_fd))
74 +unsafe { Self(FileDesc::from_raw_fd(raw_fd)) }
75 75 }
76 76 }
77 77 #[unstable(feature = "anonymous_pipe", issue = "127154")]
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ use crate::process::Stdio;
4 4 pub(crate) use crate::sys::pipe::AnonPipe;
5 5
6 6 #[inline]
7 -pub(crate) fn pipe() -> io::Result<(AnonPipe, AnonPipe)> {
7 +pub fn pipe() -> io::Result<(AnonPipe, AnonPipe)> {
8 8 Err(io::Error::UNSUPPORTED_PLATFORM)
9 9 }
10 10
Original file line number Diff line number Diff line change
@@ -8,10 +8,10 @@ use crate::sys::handle::Handle;
8 8 use crate::sys::pipe::unnamed_anon_pipe;
9 9 use crate::sys_common::{FromInner, IntoInner};
10 10
11 -pub(crate) type AnonPipe = Handle;
11 +pub type AnonPipe = Handle;
12 12
13 13 #[inline]
14 -pub(crate) fn pipe() -> io::Result<(AnonPipe, AnonPipe)> {
14 +pub fn pipe() -> io::Result<(AnonPipe, AnonPipe)> {
15 15 unnamed_anon_pipe().map(|(rx, wx)
16 16 }
17 17
@@ -31,7 +31,7 @@ impl AsRawHandle for PipeReader {
31 31 #[unstable(feature = "anonymous_pipe", issue = "127154")]
32 32 impl FromRawHandle for PipeReader {
33 33 unsafe fn from_raw_handle(raw_handle: RawHandle) -> Self {
34 -Self(Handle::from_raw_handle(raw_handle))
34 +unsafe { Self(Handle::from_raw_handle(raw_handle)) }
35 35 }
36 36 }
37 37 #[unstable(feature = "anonymous_pipe", issue = "127154")]
@@ -70,7 +70,7 @@ impl AsRawHandle for PipeWriter {
70 70 #[unstable(feature = "anonymous_pipe", issue = "127154")]
71 71 impl FromRawHandle for PipeWriter {
72 72 unsafe fn from_raw_handle(raw_handle: RawHandle) -> Self {
73 -Self(Handle::from_raw_handle(raw_handle))
73 +unsafe { Self(Handle::from_raw_handle(raw_handle)) }
74 74 }
75 75 }
76 76 #[unstable(feature = "anonymous_pipe", issue = "127154")]
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@ mod pal;
7 7
8 8 mod personality;
9 9
10 -#[unstable(feature = "anonymous_pipe", issue = "127154")]
11 10 pub mod anonymous_pipe;
12 11 pub mod backtrace;
13 12 pub mod cmath;