зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
f19fc89d4a
Коммит
1541b677a4
|
@ -49,7 +49,7 @@ impl<'a> CanvasPaintTask<'a> {
|
|||
//copy the data to the destination vector
|
||||
for _ in 0..src_read_rect.size.height {
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
for _ in 0..crop_rect.size.height {
|
||||
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;
|
||||
}
|
||||
new_image_data
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
#![feature(nonzero)]
|
||||
#![feature(slice_bytes)]
|
||||
#![feature(vec_push_all)]
|
||||
#![feature(plugin)]
|
||||
#![plugin(plugins)]
|
||||
|
||||
|
|
|
@ -1433,9 +1433,9 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
let mut pipelines_to_close = vec!();
|
||||
|
||||
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_all(&frame.prev);
|
||||
pipelines_to_close.extend_from_slice(&frame.prev);
|
||||
|
||||
pipelines_to_close
|
||||
};
|
||||
|
@ -1462,7 +1462,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
let mut frames_to_close = vec!();
|
||||
|
||||
let pipeline = self.pipeline(pipeline_id);
|
||||
frames_to_close.push_all(&pipeline.children);
|
||||
frames_to_close.extend_from_slice(&pipeline.children);
|
||||
|
||||
frames_to_close
|
||||
};
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#![feature(iter_cmp)]
|
||||
#![feature(plugin)]
|
||||
#![feature(slice_bytes)]
|
||||
#![feature(vec_push_all)]
|
||||
#![feature(mpsc_select)]
|
||||
#![feature(plugin)]
|
||||
#![plugin(plugins)]
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#![feature(plugin)]
|
||||
#![feature(str_char)]
|
||||
#![feature(unique)]
|
||||
#![feature(vec_push_all)]
|
||||
|
||||
#![plugin(plugins)]
|
||||
#![plugin(serde_macros)]
|
||||
|
|
|
@ -226,7 +226,7 @@ impl<'a> DetailedGlyphStore {
|
|||
*/
|
||||
|
||||
self.detail_lookup.push(entry);
|
||||
self.detail_buffer.push_all(glyphs);
|
||||
self.detail_buffer.extend_from_slice(glyphs);
|
||||
self.lookup_is_sorted = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -343,7 +343,7 @@ impl ImageCache {
|
|||
(ResponseAction::HeadersAvailable(_), _) => {}
|
||||
(ResponseAction::DataAvailable(data), _) => {
|
||||
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) => {
|
||||
match result {
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#![feature(fnbox)]
|
||||
#![feature(mpsc_select)]
|
||||
#![feature(plugin)]
|
||||
#![feature(vec_push_all)]
|
||||
#![feature(plugin)]
|
||||
#![plugin(plugins)]
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#![feature(plugin)]
|
||||
#![feature(slice_patterns)]
|
||||
#![feature(step_by)]
|
||||
#![feature(vec_push_all)]
|
||||
#![feature(custom_attribute)]
|
||||
#![plugin(serde_macros, plugins)]
|
||||
|
||||
|
@ -423,7 +422,7 @@ pub fn load_whole_resource(resource_task: &ResourceTask, url: Url, pipeline_id:
|
|||
let mut buf = vec!();
|
||||
loop {
|
||||
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(Err(e)) => return Err(e)
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#![feature(slice_patterns)]
|
||||
#![feature(str_utf16)]
|
||||
#![feature(unicode)]
|
||||
#![feature(vec_push_all)]
|
||||
|
||||
#![deny(unsafe_code)]
|
||||
#![allow(non_snake_case)]
|
||||
|
|
|
@ -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
|
||||
};
|
||||
|
||||
|
|
|
@ -814,7 +814,7 @@ fn interpolate_transform_list(from_list: &[TransformOperation],
|
|||
}
|
||||
} else {
|
||||
// TODO(gw): Implement matrix decomposition and interpolation
|
||||
result.push_all(from_list);
|
||||
result.extend_from_slice(from_list);
|
||||
}
|
||||
|
||||
TransformList(Some(result))
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#![feature(custom_attribute)]
|
||||
#![feature(custom_derive)]
|
||||
#![feature(plugin)]
|
||||
#![feature(vec_push_all)]
|
||||
|
||||
#![plugin(serde_macros)]
|
||||
#![plugin(serde_macros)]
|
||||
|
|
|
@ -87,7 +87,7 @@ impl Stylesheet {
|
|||
let mut bytes = vec![];
|
||||
// TODO: incremental decoding and tokenization/parsing
|
||||
for chunk in input {
|
||||
bytes.push_all(&chunk)
|
||||
bytes.extend_from_slice(&chunk)
|
||||
}
|
||||
Stylesheet::from_bytes(&bytes, base_url, protocol_encoding_label,
|
||||
environment_encoding, origin, error_reporter)
|
||||
|
|
|
@ -628,7 +628,7 @@ pub mod specified {
|
|||
let mut simplified = Vec::new();
|
||||
for product in &node.products {
|
||||
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),
|
||||
}
|
||||
}
|
||||
|
@ -681,7 +681,7 @@ pub mod specified {
|
|||
let mut simplified = Vec::new();
|
||||
for ref node in ast.products {
|
||||
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),
|
||||
}
|
||||
}
|
||||
|
@ -751,7 +751,7 @@ pub mod specified {
|
|||
let mut simplified = Vec::new();
|
||||
for ref node in ast.products {
|
||||
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),
|
||||
}
|
||||
}
|
||||
|
@ -778,7 +778,7 @@ pub mod specified {
|
|||
let mut simplified = Vec::new();
|
||||
for ref node in ast.products {
|
||||
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),
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче