diff options
| author | Florian Hahn <flo@fhahn.com> | 2015-12-15 00:03:42 +0100 |
|---|---|---|
| committer | Florian Hahn <flo@fhahn.com> | 2015-12-18 13:32:14 +0100 |
| commit | de3e843d2467dff3ccb83efbae9260dc1b2a40bf (patch) | |
| tree | 296aa9288270388391d96df8386f3437cbf8ac02 /src/libstd/io/mod.rs | |
| parent | ca52c56e346a2a2bb042bec441b5058df3e3e289 (diff) | |
| download | rust-de3e843d2467dff3ccb83efbae9260dc1b2a40bf.tar.gz rust-de3e843d2467dff3ccb83efbae9260dc1b2a40bf.zip | |
Use memchr in libstd where possible, closes #30076
Diffstat (limited to 'src/libstd/io/mod.rs')
| -rw-r--r-- | src/libstd/io/mod.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index efe40cf07c1..cc3f8097a88 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -254,6 +254,7 @@ use result; use string::String; use str; use vec::Vec; +use memchr; #[stable(feature = "rust1", since = "1.0.0")] pub use self::buffered::{BufReader, BufWriter, LineWriter}; @@ -1194,7 +1195,7 @@ fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>) Err(ref e) if e.kind() == ErrorKind::Interrupted => continue, Err(e) => return Err(e) }; - match available.iter().position(|x| *x == delim) { + match memchr::memchr(delim, available) { Some(i) => { buf.extend_from_slice(&available[..i + 1]); (true, i + 1) |
