Rollup merge of #64294 - wchargin:wchargin-stdio-piped-docs, r=Dylan-DPC

Fix `Stdio::piped` example code and lint

Summary:
Invoking `rev` does not add a trailing newline when none is present in
the input (at least on my Debian). Nearby examples use `echo` rather
than `rev`, which probably explains the source of the discrepancy.

Also, a `mut` qualifier is unused.

Test Plan:
Copy the code block into <https://play.rust-lang.org> with a `fn main`
wrapper, and run it. Note that it compiles and runs cleanly; prior to
this commit, it would emit an `unused_mut` warning and then panic.

wchargin-branch: stdio-piped-docs
This commit is contained in:
Mazdak Farrokhzad 2019-09-23 00:36:33 +02:00 committed by GitHub
commit 7894bc82d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -940,7 +940,7 @@ impl Stdio {
/// } /// }
/// ///
/// let output = child.wait_with_output().expect("Failed to read stdout"); /// let output = child.wait_with_output().expect("Failed to read stdout");
/// assert_eq!(String::from_utf8_lossy(&output.stdout), "!dlrow ,olleH\n"); /// assert_eq!(String::from_utf8_lossy(&output.stdout), "!dlrow ,olleH");
/// ``` /// ```
#[stable(feature = "process", since = "1.0.0")] #[stable(feature = "process", since = "1.0.0")]
pub fn piped() -> Stdio { Stdio(imp::Stdio::MakePipe) } pub fn piped() -> Stdio { Stdio(imp::Stdio::MakePipe) }