servo: Merge #8922 - Fix warnings: Use Vec.extend_from_slice instead of Vec.push_all (from saneyuki:warning); r=mbrubeck

Source-Repo: https://github.com/servo/servo
Source-Revision: d01233a7b417c87b18d31f10709ed83141887b94
This commit is contained in:
Tetsuharu OHZEKI 2015-12-11 04:28:58 +05:01
Родитель f19fc89d4a
Коммит 1541b677a4
17 изменённых файлов: 23 добавлений и 30 удалений

Просмотреть файл

@ -49,7 +49,7 @@ impl<'a> CanvasPaintTask<'a> {
//copy the data to the destination vector //copy the data to the destination vector
for _ in 0..src_read_rect.size.height { for _ in 0..src_read_rect.size.height {
let row = &src_data[src .. src + (4 * src_read_rect.size.width) as usize]; let row = &src_data[src .. src + (4 * src_read_rect.size.width) as usize];
image_data.push_all(row); image_data.extend_from_slice(row);
src += stride as usize; src += stride as usize;
} }
@ -707,7 +707,7 @@ fn crop_image(image_data: Vec<u8>,
let mut src = (crop_rect.origin.y * stride + crop_rect.origin.x * 4) as usize; let mut src = (crop_rect.origin.y * stride + crop_rect.origin.x * 4) as usize;
for _ in 0..crop_rect.size.height { for _ in 0..crop_rect.size.height {
let row = &image_data[src .. src + (4 * crop_rect.size.width) as usize]; let row = &image_data[src .. src + (4 * crop_rect.size.width) as usize];
new_image_data.push_all(row); new_image_data.extend_from_slice(row);
src += stride as usize; src += stride as usize;
} }
new_image_data new_image_data

Просмотреть файл

@ -4,7 +4,6 @@
#![feature(nonzero)] #![feature(nonzero)]
#![feature(slice_bytes)] #![feature(slice_bytes)]
#![feature(vec_push_all)]
#![feature(plugin)] #![feature(plugin)]
#![plugin(plugins)] #![plugin(plugins)]

Просмотреть файл

@ -1433,9 +1433,9 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
let mut pipelines_to_close = vec!(); let mut pipelines_to_close = vec!();
let frame = self.frame(frame_id); let frame = self.frame(frame_id);
pipelines_to_close.push_all(&frame.next); pipelines_to_close.extend_from_slice(&frame.next);
pipelines_to_close.push(frame.current); pipelines_to_close.push(frame.current);
pipelines_to_close.push_all(&frame.prev); pipelines_to_close.extend_from_slice(&frame.prev);
pipelines_to_close pipelines_to_close
}; };
@ -1462,7 +1462,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
let mut frames_to_close = vec!(); let mut frames_to_close = vec!();
let pipeline = self.pipeline(pipeline_id); let pipeline = self.pipeline(pipeline_id);
frames_to_close.push_all(&pipeline.children); frames_to_close.extend_from_slice(&pipeline.children);
frames_to_close frames_to_close
}; };

Просмотреть файл

@ -7,7 +7,6 @@
#![feature(iter_cmp)] #![feature(iter_cmp)]
#![feature(plugin)] #![feature(plugin)]
#![feature(slice_bytes)] #![feature(slice_bytes)]
#![feature(vec_push_all)]
#![feature(mpsc_select)] #![feature(mpsc_select)]
#![feature(plugin)] #![feature(plugin)]
#![plugin(plugins)] #![plugin(plugins)]

Просмотреть файл

@ -15,7 +15,6 @@
#![feature(plugin)] #![feature(plugin)]
#![feature(str_char)] #![feature(str_char)]
#![feature(unique)] #![feature(unique)]
#![feature(vec_push_all)]
#![plugin(plugins)] #![plugin(plugins)]
#![plugin(serde_macros)] #![plugin(serde_macros)]

Просмотреть файл

@ -226,7 +226,7 @@ impl<'a> DetailedGlyphStore {
*/ */
self.detail_lookup.push(entry); self.detail_lookup.push(entry);
self.detail_buffer.push_all(glyphs); self.detail_buffer.extend_from_slice(glyphs);
self.lookup_is_sorted = false; self.lookup_is_sorted = false;
} }

Просмотреть файл

@ -343,7 +343,7 @@ impl ImageCache {
(ResponseAction::HeadersAvailable(_), _) => {} (ResponseAction::HeadersAvailable(_), _) => {}
(ResponseAction::DataAvailable(data), _) => { (ResponseAction::DataAvailable(data), _) => {
let pending_load = self.pending_loads.get_by_key_mut(&msg.key).unwrap(); let pending_load = self.pending_loads.get_by_key_mut(&msg.key).unwrap();
pending_load.bytes.push_all(&data); pending_load.bytes.extend_from_slice(&data);
} }
(ResponseAction::ResponseComplete(result), key) => { (ResponseAction::ResponseComplete(result), key) => {
match result { match result {

Просмотреть файл

@ -6,7 +6,6 @@
#![feature(fnbox)] #![feature(fnbox)]
#![feature(mpsc_select)] #![feature(mpsc_select)]
#![feature(plugin)] #![feature(plugin)]
#![feature(vec_push_all)]
#![feature(plugin)] #![feature(plugin)]
#![plugin(plugins)] #![plugin(plugins)]

Просмотреть файл

@ -8,7 +8,6 @@
#![feature(plugin)] #![feature(plugin)]
#![feature(slice_patterns)] #![feature(slice_patterns)]
#![feature(step_by)] #![feature(step_by)]
#![feature(vec_push_all)]
#![feature(custom_attribute)] #![feature(custom_attribute)]
#![plugin(serde_macros, plugins)] #![plugin(serde_macros, plugins)]
@ -423,7 +422,7 @@ pub fn load_whole_resource(resource_task: &ResourceTask, url: Url, pipeline_id:
let mut buf = vec!(); let mut buf = vec!();
loop { loop {
match response.progress_port.recv().unwrap() { match response.progress_port.recv().unwrap() {
ProgressMsg::Payload(data) => buf.push_all(&data), ProgressMsg::Payload(data) => buf.extend_from_slice(&data),
ProgressMsg::Done(Ok(())) => return Ok((response.metadata, buf)), ProgressMsg::Done(Ok(())) => return Ok((response.metadata, buf)),
ProgressMsg::Done(Err(e)) => return Err(e) ProgressMsg::Done(Err(e)) => return Err(e)
} }

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -814,7 +814,7 @@ fn interpolate_transform_list(from_list: &[TransformOperation],
} }
} else { } else {
// TODO(gw): Implement matrix decomposition and interpolation // TODO(gw): Implement matrix decomposition and interpolation
result.push_all(from_list); result.extend_from_slice(from_list);
} }
TransformList(Some(result)) TransformList(Some(result))

Просмотреть файл

@ -9,7 +9,6 @@
#![feature(custom_attribute)] #![feature(custom_attribute)]
#![feature(custom_derive)] #![feature(custom_derive)]
#![feature(plugin)] #![feature(plugin)]
#![feature(vec_push_all)]
#![plugin(serde_macros)] #![plugin(serde_macros)]
#![plugin(serde_macros)] #![plugin(serde_macros)]

Просмотреть файл

@ -87,7 +87,7 @@ impl Stylesheet {
let mut bytes = vec![]; let mut bytes = vec![];
// TODO: incremental decoding and tokenization/parsing // TODO: incremental decoding and tokenization/parsing
for chunk in input { for chunk in input {
bytes.push_all(&chunk) bytes.extend_from_slice(&chunk)
} }
Stylesheet::from_bytes(&bytes, base_url, protocol_encoding_label, Stylesheet::from_bytes(&bytes, base_url, protocol_encoding_label,
environment_encoding, origin, error_reporter) environment_encoding, origin, error_reporter)

Просмотреть файл

@ -628,7 +628,7 @@ pub mod specified {
let mut simplified = Vec::new(); let mut simplified = Vec::new();
for product in &node.products { for product in &node.products {
match try!(CalcLengthOrPercentage::simplify_product(product)) { match try!(CalcLengthOrPercentage::simplify_product(product)) {
SimplifiedValueNode::Sum(box sum) => simplified.push_all(&sum.values), SimplifiedValueNode::Sum(box sum) => simplified.extend_from_slice(&sum.values),
val => simplified.push(val), val => simplified.push(val),
} }
} }
@ -681,7 +681,7 @@ pub mod specified {
let mut simplified = Vec::new(); let mut simplified = Vec::new();
for ref node in ast.products { for ref node in ast.products {
match try!(CalcLengthOrPercentage::simplify_product(node)) { match try!(CalcLengthOrPercentage::simplify_product(node)) {
SimplifiedValueNode::Sum(sum) => simplified.push_all(&sum.values), SimplifiedValueNode::Sum(sum) => simplified.extend_from_slice(&sum.values),
value => simplified.push(value), value => simplified.push(value),
} }
} }
@ -751,7 +751,7 @@ pub mod specified {
let mut simplified = Vec::new(); let mut simplified = Vec::new();
for ref node in ast.products { for ref node in ast.products {
match try!(CalcLengthOrPercentage::simplify_product(node)) { match try!(CalcLengthOrPercentage::simplify_product(node)) {
SimplifiedValueNode::Sum(sum) => simplified.push_all(&sum.values), SimplifiedValueNode::Sum(sum) => simplified.extend_from_slice(&sum.values),
value => simplified.push(value), value => simplified.push(value),
} }
} }
@ -778,7 +778,7 @@ pub mod specified {
let mut simplified = Vec::new(); let mut simplified = Vec::new();
for ref node in ast.products { for ref node in ast.products {
match try!(CalcLengthOrPercentage::simplify_product(node)) { match try!(CalcLengthOrPercentage::simplify_product(node)) {
SimplifiedValueNode::Sum(sum) => simplified.push_all(&sum.values), SimplifiedValueNode::Sum(sum) => simplified.extend_from_slice(&sum.values),
value => simplified.push(value), value => simplified.push(value),
} }
} }