Fix warnings: Use Vec.extend_from_slice instead of Vec.push_all

This commit is contained in:
Tetsuharu OHZEKI 2015-12-10 15:58:12 -05:00
parent b756375637
commit e8c12c1c6d
17 changed files with 23 additions and 30 deletions

View file

@ -140,7 +140,7 @@ impl BlobMethods for Blob {
let start = relativeStart.to_usize().unwrap();
let end = (relativeStart + span).to_usize().unwrap();
let mut bytes: Vec<u8> = Vec::new();
bytes.push_all(&vec[start..end]);
bytes.extend_from_slice(&vec[start..end]);
Blob::new(global.r(), Some(bytes), &relativeContentType)
}
}

View file

@ -253,7 +253,7 @@ impl XMLHttpRequest {
}
fn data_available(&mut self, payload: Vec<u8>) {
self.buf.borrow_mut().push_all(&payload);
self.buf.borrow_mut().extend_from_slice(&payload);
self.xhr.root().process_data_available(self.gen_id, self.buf.borrow().clone());
}
@ -403,8 +403,8 @@ impl XMLHttpRequestMethods for XMLHttpRequest {
Some(raw) => {
debug!("SetRequestHeader: old value = {:?}", raw[0]);
let mut buf = raw[0].clone();
buf.push_all(b", ");
buf.push_all(&value);
buf.extend_from_slice(b", ");
buf.extend_from_slice(&value);
debug!("SetRequestHeader: new value = {:?}", buf);
value = ByteString::new(buf);
},
@ -530,8 +530,8 @@ impl XMLHttpRequestMethods for XMLHttpRequest {
fn join_raw(a: &str, b: &str) -> Vec<u8> {
let len = a.len() + b.len();
let mut vec = Vec::with_capacity(len);
vec.push_all(a.as_bytes());
vec.push_all(b.as_bytes());
vec.extend_from_slice(a.as_bytes());
vec.extend_from_slice(b.as_bytes());
vec
}

View file

@ -22,7 +22,6 @@
#![feature(slice_patterns)]
#![feature(str_utf16)]
#![feature(unicode)]
#![feature(vec_push_all)]
#![deny(unsafe_code)]
#![allow(non_snake_case)]

View file

@ -235,9 +235,9 @@ impl<T: ClipboardProvider> TextInput<T> {
insert_lines[last_insert_lines_index].push_str(suffix);
let mut new_lines = vec!();
new_lines.push_all(lines_prefix);
new_lines.push_all(&insert_lines);
new_lines.push_all(lines_suffix);
new_lines.extend_from_slice(lines_prefix);
new_lines.extend_from_slice(&insert_lines);
new_lines.extend_from_slice(lines_suffix);
new_lines
};