Replace uses of for foo in bar.iter(),

and `for foo in bar.iter_mut(), and for foo in bar.into_iter()
(continuation of #7197)
This commit is contained in:
João Oliveira 2015-08-18 01:36:04 +01:00
parent f4b526cfb4
commit 067a22a868
32 changed files with 76 additions and 78 deletions

View file

@ -401,7 +401,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
(Msg::AssignPaintedBuffers(pipeline_id, epoch, replies, frame_tree_id),
ShutdownState::NotShuttingDown) => {
for (layer_id, new_layer_buffer_set) in replies.into_iter() {
for (layer_id, new_layer_buffer_set) in replies {
self.assign_painted_buffers(pipeline_id,
layer_id,
new_layer_buffer_set,
@ -1033,7 +1033,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
fn process_pending_scroll_events(&mut self) {
let had_scroll_events = self.pending_scroll_events.len() > 0;
for scroll_event in std_mem::replace(&mut self.pending_scroll_events,
Vec::new()).into_iter() {
Vec::new()) {
let delta = scroll_event.delta / self.scene.scale;
let cursor = scroll_event.cursor.as_f32() / self.scene.scale;
@ -1073,7 +1073,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
.unwrap()
.push((extra_layer_data.id, visible_rect));
for kid in layer.children.borrow().iter() {
for kid in &*layer.children.borrow() {
process_layer(&*kid, window_size, new_display_ports)
}
}
@ -1246,7 +1246,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
let scale = self.device_pixels_per_page_px();
let mut results: HashMap<PipelineId, Vec<PaintRequest>> = HashMap::new();
for (layer, mut layer_requests) in requests.into_iter() {
for (layer, mut layer_requests) in requests {
let pipeline_id = layer.pipeline_id();
let current_epoch = self.pipeline_details.get(&pipeline_id).unwrap().current_epoch;
layer.extra_data.borrow_mut().requested_epoch = current_epoch;
@ -1293,7 +1293,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
pipeline.script_chan.send(ConstellationControlMsg::Viewport(pipeline.id.clone(), layer_rect)).unwrap();
}
for kid in layer.children().iter() {
for kid in &*layer.children() {
self.send_viewport_rect_for_layer(kid.clone());
}
}
@ -1329,7 +1329,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
let pipeline_requests =
self.convert_buffer_requests_to_pipeline_requests_map(layers_and_requests);
for (pipeline_id, requests) in pipeline_requests.into_iter() {
for (pipeline_id, requests) in pipeline_requests {
let msg = ChromeToPaintMsg::Paint(requests, self.frame_tree_id);
let _ = self.get_pipeline(pipeline_id).chrome_to_paint_chan.send(msg);
}
@ -1357,7 +1357,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
return true;
}
for child in layer.children().iter() {
for child in &*layer.children() {
if self.does_layer_have_outstanding_paint_messages(child) {
return true;
}
@ -1659,7 +1659,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
*layer.bounds.borrow(),
*layer.masks_to_bounds.borrow(),
layer.establishes_3d_context);
for kid in layer.children().iter() {
for kid in &*layer.children() {
self.dump_layer_tree_with_indent(&**kid, level + 1)
}
}
@ -1674,7 +1674,7 @@ fn find_layer_with_pipeline_and_layer_id_for_layer(layer: Rc<Layer<CompositorDat
return Some(layer);
}
for kid in layer.children().iter() {
for kid in &*layer.children() {
let result = find_layer_with_pipeline_and_layer_id_for_layer(kid.clone(),
pipeline_id,
layer_id);
@ -1708,7 +1708,7 @@ impl<Window> CompositorEventListener for IOCompositor<Window> where Window: Wind
}
// Handle any messages coming from the windowing system.
for message in messages.into_iter() {
for message in messages {
self.handle_window_message(message);
}

View file

@ -250,7 +250,7 @@ impl CompositorLayer for Layer<CompositorData> {
compositor: &mut IOCompositor<Window>)
where Window: WindowMethods {
self.clear(compositor);
for kid in self.children().iter() {
for kid in &*self.children() {
kid.clear_all_tiles(compositor);
}
}
@ -273,7 +273,7 @@ impl CompositorLayer for Layer<CompositorData> {
}
None => {
// Wasn't found, recurse into child layers
for kid in self.children().iter() {
for kid in &*self.children() {
kid.remove_root_layer_with_pipeline_id(compositor, pipeline_id);
}
}
@ -288,7 +288,7 @@ impl CompositorLayer for Layer<CompositorData> {
// Traverse children first so that layers are removed
// bottom up - allowing each layer being removed to properly
// clean up any tiles it owns.
for kid in self.children().iter() {
for kid in &*self.children() {
kid.collect_old_layers(compositor, pipeline_id, new_layers);
}
@ -324,12 +324,12 @@ impl CompositorLayer for Layer<CompositorData> {
/// This is used during shutdown, when we know the paint task is going away.
fn forget_all_tiles(&self) {
let tiles = self.collect_buffers();
for tile in tiles.into_iter() {
for tile in tiles {
let mut tile = tile;
tile.mark_wont_leak()
}
for kid in self.children().iter() {
for kid in &*self.children() {
kid.forget_all_tiles();
}
}
@ -341,7 +341,7 @@ impl CompositorLayer for Layer<CompositorData> {
// Allow children to scroll.
let scroll_offset = self.extra_data.borrow().scroll_offset;
let new_cursor = cursor - scroll_offset;
for child in self.children().iter() {
for child in &*self.children() {
let child_bounds = child.bounds.borrow();
if child_bounds.contains(&new_cursor) {
let result = child.handle_scroll_event(delta, new_cursor - child_bounds.origin);
@ -378,7 +378,7 @@ impl CompositorLayer for Layer<CompositorData> {
self.extra_data.borrow_mut().scroll_offset = new_offset;
let mut result = false;
for child in self.children().iter() {
for child in &*self.children() {
result |= child.scroll_layer_and_all_child_layers(new_offset);
}
@ -429,7 +429,7 @@ impl CompositorLayer for Layer<CompositorData> {
}
let offset_for_children = new_offset + self.extra_data.borrow().scroll_offset;
for child in self.children().iter() {
for child in &*self.children() {
result |= child.scroll_layer_and_all_child_layers(offset_for_children);
}

View file

@ -69,7 +69,7 @@ impl SurfaceMap {
}
pub fn insert_surfaces(&mut self, display: &NativeDisplay, surfaces: Vec<NativeSurface>) {
for surface in surfaces.into_iter() {
for surface in surfaces {
self.insert(display, surface);
}
}