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.

See also tokio-rs/website#49.
  • Loading branch information
mbrubeck committed Jan 21, 2017
1 parent 119df67 commit 482614a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions multiplexed/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ impl Codec for LineCodec {
let mut encoded_request_id = [0; 4];
BigEndian::write_u32(&mut encoded_request_id, request_id as u32);

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

Ok(())
Expand Down
2 changes: 1 addition & 1 deletion simple/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ impl Codec for LineCodec {
}

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 streaming/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,11 +304,11 @@ impl Codec for LineCodec {
// 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 482614a

Please sign in to comment.