Skip to content

Commit 693a8f3

Browse files
mbrubeckvibhoothi
authored andcommitted
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.
1 parent b6088d0 commit 693a8f3

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

content/docs/getting-started/simple-server.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ we won't provide support for error responses:
172172
fn encode(&mut self, msg: String, buf: &mut Vec<u8>)
173173
-> io::Result<()>
174174
{
175-
buf.extend_from_slice(msg.as_bytes());
175+
buf.extend(msg.as_bytes());
176176
buf.push(b'\n');
177177
Ok(())
178178
}

content/docs/going-deeper/multiplex.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ impl Codec for LineCodec {
146146
let mut encoded_id = [0; 4];
147147
BigEndian::write_u32(&mut encoded_id, id as u32);
148148

149-
buf.extend_from_slice(&encoded_id);
150-
buf.extend_from_slice(msg.as_bytes());
149+
buf.extend(&encoded_id);
150+
buf.extend(msg.as_bytes());
151151
buf.push(b'\n');
152152

153153
Ok(())

content/docs/going-deeper/streaming.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,11 @@ impl Codec for LineCodec {
184184
// includes a streaming body is an empty string.
185185
assert!(message.is_empty() == body);
186186

187-
buf.extend_from_slice(message.as_bytes());
187+
buf.extend(message.as_bytes());
188188
}
189189
Frame::Body { chunk } => {
190190
if let Some(chunk) = chunk {
191-
buf.extend_from_slice(chunk.as_bytes());
191+
buf.extend(chunk.as_bytes());
192192
}
193193
}
194194
Frame::Error { error } => {

0 commit comments

Comments
 (0)