@@ -41,11 +41,9 @@ use crate::sys::anonymous_pipe::{AnonPipe, pipe as pipe_inner};
4141///
4242/// ```no_run
4343/// #![feature(anonymous_pipe)]
44- /// # #[cfg(miri)] fn main() {}
45- /// # #[cfg(not(miri))]
46- /// # fn main() -> std::io::Result<()> {
4744/// use std::process::Command;
4845/// use std::io::{pipe, Read, Write};
46+ ///
4947/// let (ping_rx, mut ping_tx) = pipe()?;
5048/// let (mut pong_rx, pong_tx) = pipe()?;
5149///
@@ -62,8 +60,7 @@ use crate::sys::anonymous_pipe::{AnonPipe, pipe as pipe_inner};
6260/// assert_eq!(&buf, "hello");
6361///
6462/// echo_server.wait()?;
65- /// # Ok(())
66- /// # }
63+ /// # Ok::<(), std::io::Error>(())
6764/// ```
6865/// [changes]: io#platform-specific-behavior
6966/// [man page]: https://man7.org/linux/man-pages/man7/pipe.7.html
@@ -90,12 +87,10 @@ impl PipeReader {
9087 ///
9188 /// ```no_run
9289 /// #![feature(anonymous_pipe)]
93- /// # #[cfg(miri)] fn main() {}
94- /// # #[cfg(not(miri))]
95- /// # fn main() -> std::io::Result<()> {
9690 /// use std::fs;
9791 /// use std::io::{pipe, Write};
9892 /// use std::process::Command;
93+ ///
9994 /// const NUM_SLOT: u8 = 2;
10095 /// const NUM_PROC: u8 = 5;
10196 /// const OUTPUT: &str = "work.txt";
@@ -134,8 +129,7 @@ impl PipeReader {
134129 /// let xs = fs::read_to_string(OUTPUT)?;
135130 /// fs::remove_file(OUTPUT)?;
136131 /// assert_eq!(xs, "x".repeat(NUM_PROC.into()));
137- /// # Ok(())
138- /// # }
132+ /// # Ok::<(), std::io::Error>(())
139133 /// ```
140134 #[ unstable( feature = "anonymous_pipe" , issue = "127154" ) ]
141135 pub fn try_clone ( & self ) -> io:: Result < Self > {
@@ -150,11 +144,9 @@ impl PipeWriter {
150144 ///
151145 /// ```no_run
152146 /// #![feature(anonymous_pipe)]
153- /// # #[cfg(miri)] fn main() {}
154- /// # #[cfg(not(miri))]
155- /// # fn main() -> std::io::Result<()> {
156147 /// use std::process::Command;
157148 /// use std::io::{pipe, Read};
149+ ///
158150 /// let (mut reader, writer) = pipe()?;
159151 ///
160152 /// // Spawn a process that writes to stdout and stderr.
@@ -174,8 +166,7 @@ impl PipeWriter {
174166 /// assert_eq!(&msg, "foobar");
175167 ///
176168 /// peer.wait()?;
177- /// # Ok(())
178- /// # }
169+ /// # Ok::<(), std::io::Error>(())
179170 /// ```
180171 #[ unstable( feature = "anonymous_pipe" , issue = "127154" ) ]
181172 pub fn try_clone ( & self ) -> io:: Result < Self > {
0 commit comments