about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-09-23 00:36:33 +0200
committerGitHub <noreply@github.com>2019-09-23 00:36:33 +0200
commit7894bc82d790c9ef700d0576f2c1e5756a07532d (patch)
treeb56a31bfd7a246da384f5cf158f2487d356834f1
parent1dd1884891636d0eb51157d137230076bcf20627 (diff)
parent9bf577311473aa0accbf0d456cbd26b7530b200f (diff)
downloadrust-7894bc82d790c9ef700d0576f2c1e5756a07532d.tar.gz
rust-7894bc82d790c9ef700d0576f2c1e5756a07532d.zip
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
-rw-r--r--src/libstd/process.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libstd/process.rs b/src/libstd/process.rs
index c6dc02fea2d..da136ca6bf6 100644
--- a/src/libstd/process.rs
+++ b/src/libstd/process.rs
@@ -940,7 +940,7 @@ impl Stdio {
     /// }
     ///
     /// 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")]
     pub fn piped() -> Stdio { Stdio(imp::Stdio::MakePipe) }