about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-04-25 17:49:00 +0000
committerbors <bors@rust-lang.org>2020-04-25 17:49:00 +0000
commit0862458dad90a0d80827e22e3f86e33add6d847c (patch)
tree6e8ac1b700ed0a337d35aa5a1d62e96071b1ac42 /src/libstd
parent659951c4a0d7450e43f61c61c0e87d0ceae17087 (diff)
parent82642d708fdd57a2072ef1d182558df5909380b0 (diff)
Auto merge of #71556 - Dylan-DPC:rollup-9ll4shr, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #69041 (proc_macro: Stabilize `Span::resolved_at` and `Span::located_at`)
 - #69813 (Implement BitOr and BitOrAssign for the NonZero integer types)
 - #70712 (stabilize BTreeMap::remove_entry)
 - #71168 (Deprecate `{Box,Rc,Arc}::into_raw_non_null`)
 - #71544 (Replace filter_map().next() calls with find_map())
 - #71545 (Fix comment in docstring example for Error::kind)
 - #71548 (Add missing Send and Sync impls for linked list Cursor and CursorMut.)

Failed merges:

r? @ghost
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/io/buffered.rs13
-rw-r--r--src/libstd/io/error.rs4
2 files changed, 6 insertions, 11 deletions
diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs
index 8862226adbb..16ca539b3c1 100644
--- a/src/libstd/io/buffered.rs
+++ b/src/libstd/io/buffered.rs
@@ -1043,15 +1043,10 @@ impl<W: Write> Write for LineWriter<W> {
         }
 
         // Find the last newline, and failing that write the whole buffer
-        let last_newline = bufs
-            .iter()
-            .enumerate()
-            .rev()
-            .filter_map(|(i, buf)| {
-                let pos = memchr::memrchr(b'\n', buf)?;
-                Some((i, pos))
-            })
-            .next();
+        let last_newline = bufs.iter().enumerate().rev().find_map(|(i, buf)| {
+            let pos = memchr::memrchr(b'\n', buf)?;
+            Some((i, pos))
+        });
         let (i, j) = match last_newline {
             Some(pair) => pair,
             None => return self.inner.write_vectored(bufs),
diff --git a/src/libstd/io/error.rs b/src/libstd/io/error.rs
index 3b55d9b9002..d80a38819ea 100644
--- a/src/libstd/io/error.rs
+++ b/src/libstd/io/error.rs
@@ -487,9 +487,9 @@ impl Error {
     /// }
     ///
     /// fn main() {
-    ///     // Will print "No inner error".
+    ///     // Will print "Other".
     ///     print_error(Error::last_os_error());
-    ///     // Will print "Inner error: ...".
+    ///     // Will print "AddrInUse".
     ///     print_error(Error::new(ErrorKind::AddrInUse, "oh no!"));
     /// }
     /// ```