mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Use chunk.as_ref() instead of &chunk.into_bytes()
This commit is contained in:
parent
dcbe7d36ae
commit
85c6eff94a
1 changed files with 3 additions and 3 deletions
|
@ -81,7 +81,7 @@ impl Stream for WrappedBody {
|
|||
Decoder::Plain => Some(chunk),
|
||||
Decoder::Gzip(Some(ref mut decoder)) => {
|
||||
let mut buf = vec![0; BUF_SIZE];
|
||||
decoder.get_mut().get_mut().extend(&chunk.into_bytes());
|
||||
decoder.get_mut().get_mut().extend(chunk.as_ref());
|
||||
let len = decoder.read(&mut buf).ok()?;
|
||||
buf.truncate(len);
|
||||
Some(buf.into())
|
||||
|
@ -96,14 +96,14 @@ impl Stream for WrappedBody {
|
|||
},
|
||||
Decoder::Deflate(ref mut decoder) => {
|
||||
let mut buf = vec![0; BUF_SIZE];
|
||||
decoder.get_mut().get_mut().extend(&chunk.into_bytes());
|
||||
decoder.get_mut().get_mut().extend(chunk.as_ref());
|
||||
let len = decoder.read(&mut buf).ok()?;
|
||||
buf.truncate(len);
|
||||
Some(buf.into())
|
||||
},
|
||||
Decoder::Brotli(ref mut decoder) => {
|
||||
let mut buf = vec![0; BUF_SIZE];
|
||||
decoder.get_mut().get_mut().extend(&chunk.into_bytes());
|
||||
decoder.get_mut().get_mut().extend(chunk.as_ref());
|
||||
let len = decoder.read(&mut buf).ok()?;
|
||||
buf.truncate(len);
|
||||
Some(buf.into())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue