Skip to content
This repository has been archived by the owner on Feb 10, 2018. It is now read-only.

Use extend instead of extend_from_slice #22

Merged
merged 1 commit into from
Jan 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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