Skip to content

Commit 482614a

Browse files
committed
Use extend instead of extend_from_slice
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.
1 parent 119df67 commit 482614a

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

multiplexed/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,8 @@ impl Codec for LineCodec {
196196
let mut encoded_request_id = [0; 4];
197197
BigEndian::write_u32(&mut encoded_request_id, request_id as u32);
198198

199-
buf.extend_from_slice(&encoded_request_id);
200-
buf.extend_from_slice(msg.as_bytes());
199+
buf.extend(&encoded_request_id);
200+
buf.extend(msg.as_bytes());
201201
buf.push(b'\n');
202202

203203
Ok(())

simple/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ impl Codec for LineCodec {
196196
}
197197

198198
fn encode(&mut self, msg: String, buf: &mut Vec<u8>) -> io::Result<()> {
199-
buf.extend_from_slice(msg.as_bytes());
199+
buf.extend(msg.as_bytes());
200200
buf.push(b'\n');
201201

202202
Ok(())

streaming/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,11 +304,11 @@ impl Codec for LineCodec {
304304
// streaming body is an empty string.
305305
assert!(message.is_empty() == body);
306306

307-
buf.extend_from_slice(message.as_bytes());
307+
buf.extend(message.as_bytes());
308308
}
309309
Frame::Body { chunk } => {
310310
if let Some(chunk) = chunk {
311-
buf.extend_from_slice(chunk.as_bytes());
311+
buf.extend(chunk.as_bytes());
312312
}
313313
}
314314
Frame::Error { error } => {

0 commit comments

Comments
 (0)