about summary refs log tree commit diff
path: root/src/libstd/io/buffered.rs
diff options
context:
space:
mode:
authorMichael McConville <mmcco@mykolab.com>2015-12-18 22:37:00 -0500
committerMichael McConville <mmcco@mykolab.com>2015-12-18 22:37:00 -0500
commite8d2706cbac46eac7f4cd1554c41c748e00a4a00 (patch)
tree556cad53a8d415b3b3a660d756d3bc20bf1609cb /src/libstd/io/buffered.rs
parent33113f86f4c4f191d1bf42642b1a7714c576e395 (diff)
parent8ad12c3e251df6b8ed42b4d32709f4f55470a0be (diff)
downloadrust-e8d2706cbac46eac7f4cd1554c41c748e00a4a00.tar.gz
rust-e8d2706cbac46eac7f4cd1554c41c748e00a4a00.zip
Merge branch 'master' of https://github.com/rust-lang/rust
Diffstat (limited to 'src/libstd/io/buffered.rs')
-rw-r--r--src/libstd/io/buffered.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs
index 90a79da3483..79eedbeda2c 100644
--- a/src/libstd/io/buffered.rs
+++ b/src/libstd/io/buffered.rs
@@ -18,6 +18,7 @@ use cmp;
 use error;
 use fmt;
 use io::{self, DEFAULT_BUF_SIZE, Error, ErrorKind, SeekFrom};
+use memchr;
 
 /// The `BufReader` struct adds buffering to any reader.
 ///
@@ -746,7 +747,7 @@ impl<W: Write> LineWriter<W> {
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<W: Write> Write for LineWriter<W> {
     fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
-        match buf.iter().rposition(|b| *b == b'\n') {
+        match memchr::memrchr(b'\n', buf) {
             Some(i) => {
                 let n = try!(self.inner.write(&buf[..i + 1]));
                 if n != i + 1 { return Ok(n) }