Skip to content

Commit

Permalink
Use extend instead of extend_from_slice
Browse files Browse the repository at this point in the history
These are identical since rust-lang/rust#37094 landed, and
`extend_from_slice` will be deprecated in the future.
  • Loading branch information
mbrubeck authored and vibhoothi committed Aug 23, 2019
1 parent b6088d0 commit 693a8f3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion content/docs/getting-started/simple-server.md
Expand Up @@ -172,7 +172,7 @@ we won't provide support for error responses:
fn encode(&mut self, msg: String, buf: &mut Vec<u8>)
-> io::Result<()>
{
buf.extend_from_slice(msg.as_bytes());
buf.extend(msg.as_bytes());
buf.push(b'\n');
Ok(())
}
Expand Down
4 changes: 2 additions & 2 deletions content/docs/going-deeper/multiplex.md
Expand Up @@ -146,8 +146,8 @@ impl Codec for LineCodec {
let mut encoded_id = [0; 4];
BigEndian::write_u32(&mut encoded_id, id as u32);

buf.extend_from_slice(&encoded_id);
buf.extend_from_slice(msg.as_bytes());
buf.extend(&encoded_id);
buf.extend(msg.as_bytes());
buf.push(b'\n');

Ok(())
Expand Down
4 changes: 2 additions & 2 deletions content/docs/going-deeper/streaming.md
Expand Up @@ -184,11 +184,11 @@ impl Codec for LineCodec {
// includes a streaming body is an empty string.
assert!(message.is_empty() == body);

buf.extend_from_slice(message.as_bytes());
buf.extend(message.as_bytes());
}
Frame::Body { chunk } => {
if let Some(chunk) = chunk {
buf.extend_from_slice(chunk.as_bytes());
buf.extend(chunk.as_bytes());
}
}
Frame::Error { error } => {
Expand Down

0 comments on commit 693a8f3

Please sign in to comment.