diff options
| author | bors <bors@rust-lang.org> | 2016-01-22 06:04:50 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2016-01-22 06:04:50 +0000 |
| commit | 00ee90f0f091916c3a4d42c48ccd71186186ffae (patch) | |
| tree | 787149ff40ac3b50fceb542e90f3f5d05ce199f6 /src/libstd/io/buffered.rs | |
| parent | 62c8256b9f6f219712a2403e7b7cf1e67a5a31d4 (diff) | |
| parent | b740c557e2864719f8ef5953142cbe53fd3b51dd (diff) | |
| download | rust-00ee90f0f091916c3a4d42c48ccd71186186ffae.tar.gz rust-00ee90f0f091916c3a4d42c48ccd71186186ffae.zip | |
Auto merge of #31070 - sfackler:bufreader-box-slice, r=alexcrichton
Saves a word, and also prevents the impl from accidentally changing the buffer length. r? @alexcrichton
Diffstat (limited to 'src/libstd/io/buffered.rs')
| -rw-r--r-- | src/libstd/io/buffered.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs index 625818a295a..5ec51eaa567 100644 --- a/src/libstd/io/buffered.rs +++ b/src/libstd/io/buffered.rs @@ -47,7 +47,7 @@ use memchr; #[stable(feature = "rust1", since = "1.0.0")] pub struct BufReader<R> { inner: R, - buf: Vec<u8>, + buf: Box<[u8]>, pos: usize, cap: usize, } @@ -92,7 +92,7 @@ impl<R: Read> BufReader<R> { pub fn with_capacity(cap: usize, inner: R) -> BufReader<R> { BufReader { inner: inner, - buf: vec![0; cap], + buf: vec![0; cap].into_boxed_slice(), pos: 0, cap: 0, } |
