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

View file

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

View file

@ -150,7 +150,7 @@ impl ActorRegistry {
} }
pub fn actor_to_script(&self, actor: String) -> String { pub fn actor_to_script(&self, actor: String) -> String {
for (key, value) in self.script_actors.borrow().iter() { for (key, value) in &*self.script_actors.borrow() {
println!("checking {}", value); println!("checking {}", value);
if *value == actor { if *value == actor {
return key.to_string(); return key.to_string();
@ -213,7 +213,7 @@ impl ActorRegistry {
} }
let old_actors = replace(&mut *self.old_actors.borrow_mut(), vec!()); let old_actors = replace(&mut *self.old_actors.borrow_mut(), vec!());
for name in old_actors.into_iter() { for name in old_actors {
self.drop_actor(name); self.drop_actor(name);
} }
Ok(()) Ok(())

View file

@ -297,7 +297,7 @@ fn run_server(sender: Sender<DevtoolsControlMsg>,
columnNumber: console_message.columnNumber, columnNumber: console_message.columnNumber,
}, },
}; };
for stream in console_actor.streams.borrow_mut().iter_mut() { for mut stream in &mut *console_actor.streams.borrow_mut() {
stream.write_json_packet(&msg); stream.write_json_packet(&msg);
} }
} }

View file

@ -340,7 +340,7 @@ impl StackingContext {
} }
// Step 3: Positioned descendants with negative z-indices. // Step 3: Positioned descendants with negative z-indices.
for positioned_kid in positioned_children.iter() { for positioned_kid in &*positioned_children {
if positioned_kid.z_index >= 0 { if positioned_kid.z_index >= 0 {
break break
} }
@ -382,7 +382,7 @@ impl StackingContext {
} }
// Step 9: Positioned descendants with nonnegative, numeric z-indices. // Step 9: Positioned descendants with nonnegative, numeric z-indices.
for positioned_kid in positioned_children.iter() { for positioned_kid in &*positioned_children {
if positioned_kid.z_index < 0 { if positioned_kid.z_index < 0 {
continue continue
} }
@ -554,12 +554,12 @@ impl StackingContext {
// borders. // borders.
// //
// TODO(pcwalton): Step 6: Inlines that generate stacking contexts. // TODO(pcwalton): Step 6: Inlines that generate stacking contexts.
for display_list in [ for display_list in &[
&self.display_list.positioned_content, &self.display_list.positioned_content,
&self.display_list.content, &self.display_list.content,
&self.display_list.floats, &self.display_list.floats,
&self.display_list.block_backgrounds_and_borders, &self.display_list.block_backgrounds_and_borders,
].iter() { ] {
hit_test_in_list(point, result, topmost_only, display_list.iter().rev()); hit_test_in_list(point, result, topmost_only, display_list.iter().rev());
if topmost_only && !result.is_empty() { if topmost_only && !result.is_empty() {
return return
@ -614,7 +614,7 @@ pub fn find_stacking_context_with_layer_id(this: &Arc<StackingContext>, layer_id
Some(_) | None => {} Some(_) | None => {}
} }
for kid in this.display_list.children.iter() { for kid in &this.display_list.children {
match find_stacking_context_with_layer_id(kid, layer_id) { match find_stacking_context_with_layer_id(kid, layer_id) {
Some(stacking_context) => return Some(stacking_context), Some(stacking_context) => return Some(stacking_context),
None => {} None => {}
@ -755,7 +755,7 @@ impl ClippingRegion {
#[inline] #[inline]
pub fn bounding_rect(&self) -> Rect<Au> { pub fn bounding_rect(&self) -> Rect<Au> {
let mut rect = self.main; let mut rect = self.main;
for complex in self.complex.iter() { for complex in &*self.complex {
rect = rect.union(&complex.rect) rect = rect.union(&complex.rect)
} }
rect rect

View file

@ -233,7 +233,7 @@ impl<C> PaintTask<C> where C: PaintListener + Send + 'static {
let mut replies = Vec::new(); let mut replies = Vec::new();
for PaintRequest { buffer_requests, scale, layer_id, epoch, layer_kind } for PaintRequest { buffer_requests, scale, layer_id, epoch, layer_kind }
in requests.into_iter() { in requests {
if self.current_epoch == Some(epoch) { if self.current_epoch == Some(epoch) {
self.paint(&mut replies, buffer_requests, scale, layer_id, layer_kind); self.paint(&mut replies, buffer_requests, scale, layer_id, layer_kind);
} else { } else {
@ -393,7 +393,7 @@ impl<C> PaintTask<C> where C: PaintListener + Send + 'static {
} }
}; };
for kid in stacking_context.display_list.children.iter() { for kid in &stacking_context.display_list.children {
build(properties, &**kid, &page_position, &transform, &perspective, next_parent_id) build(properties, &**kid, &page_position, &transform, &perspective, next_parent_id)
} }
} }

View file

@ -29,7 +29,7 @@ pub fn start_transitions_if_applicable(new_animations_sender: &Sender<Animation>
for i in 0..new_style.get_animation().transition_property.0.len() { for i in 0..new_style.get_animation().transition_property.0.len() {
// Create any property animations, if applicable. // Create any property animations, if applicable.
let property_animations = PropertyAnimation::from_transition(i, old_style, new_style); let property_animations = PropertyAnimation::from_transition(i, old_style, new_style);
for property_animation in property_animations.into_iter() { for property_animation in property_animations {
// Set the property to the initial value. // Set the property to the initial value.
property_animation.update(new_style, 0.0); property_animation.update(new_style, 0.0);
@ -65,7 +65,7 @@ pub fn process_new_animations(rw_data: &mut LayoutTaskData, pipeline_id: Pipelin
} }
// Add new running animations. // Add new running animations.
for new_running_animation in new_running_animations.into_iter() { for new_running_animation in new_running_animations {
match running_animations.entry(OpaqueNode(new_running_animation.node)) { match running_animations.entry(OpaqueNode(new_running_animation.node)) {
Entry::Vacant(entry) => { Entry::Vacant(entry) => {
entry.insert(vec![new_running_animation]); entry.insert(vec![new_running_animation]);

View file

@ -548,7 +548,7 @@ impl<'a> FlowConstructor<'a> {
fragments: successor_fragments, fragments: successor_fragments,
})) => { })) => {
// Add any {ib} splits. // Add any {ib} splits.
for split in splits.into_iter() { for split in splits {
// Pull apart the {ib} split object and push its predecessor fragments // Pull apart the {ib} split object and push its predecessor fragments
// onto the list. // onto the list.
let InlineBlockSplit { let InlineBlockSplit {
@ -722,7 +722,7 @@ impl<'a> FlowConstructor<'a> {
let mut style = (*style).clone(); let mut style = (*style).clone();
properties::modify_style_for_text(&mut style); properties::modify_style_for_text(&mut style);
for content_item in text_content.into_iter() { for content_item in text_content {
let specific = match content_item { let specific = match content_item {
ContentItem::String(string) => { ContentItem::String(string) => {
let info = UnscannedTextFragmentInfo::from_text(string); let info = UnscannedTextFragmentInfo::from_text(string);
@ -765,7 +765,7 @@ impl<'a> FlowConstructor<'a> {
node: &ThreadSafeLayoutNode, node: &ThreadSafeLayoutNode,
fragment_accumulator: &mut InlineFragmentsAccumulator, fragment_accumulator: &mut InlineFragmentsAccumulator,
opt_inline_block_splits: &mut LinkedList<InlineBlockSplit>) { opt_inline_block_splits: &mut LinkedList<InlineBlockSplit>) {
for split in splits.into_iter() { for split in splits {
let InlineBlockSplit { let InlineBlockSplit {
predecessors, predecessors,
flow: kid_flow flow: kid_flow
@ -1038,7 +1038,7 @@ impl<'a> FlowConstructor<'a> {
node: &ThreadSafeLayoutNode) { node: &ThreadSafeLayoutNode) {
let mut anonymous_flow = flow.generate_missing_child_flow(node); let mut anonymous_flow = flow.generate_missing_child_flow(node);
let mut consecutive_siblings = vec!(); let mut consecutive_siblings = vec!();
for kid_flow in child_flows.into_iter() { for kid_flow in child_flows {
if anonymous_flow.need_anonymous_flow(&*kid_flow) { if anonymous_flow.need_anonymous_flow(&*kid_flow) {
consecutive_siblings.push(kid_flow); consecutive_siblings.push(kid_flow);
continue; continue;

View file

@ -727,7 +727,7 @@ impl AbsoluteDescendants {
/// ///
/// Ignore any static y offsets, because they are None before layout. /// Ignore any static y offsets, because they are None before layout.
pub fn push_descendants(&mut self, given_descendants: AbsoluteDescendants) { pub fn push_descendants(&mut self, given_descendants: AbsoluteDescendants) {
for elem in given_descendants.descendant_links.into_iter() { for elem in given_descendants.descendant_links {
self.descendant_links.push(elem); self.descendant_links.push(elem);
} }
} }

View file

@ -277,11 +277,10 @@ impl<'a,'b> ResolveGeneratedContentFragmentMutator<'a,'b> {
self.traversal.counters.insert((*counter_name).clone(), counter); self.traversal.counters.insert((*counter_name).clone(), counter);
} }
for &(ref counter_name, value) in fragment.style() for &(ref counter_name, value) in &fragment.style()
.get_counters() .get_counters()
.counter_increment .counter_increment
.0 .0 {
.iter() {
if let Some(ref mut counter) = self.traversal.counters.get_mut(counter_name) { if let Some(ref mut counter) = self.traversal.counters.get_mut(counter_name) {
counter.increment(self.level, value); counter.increment(self.level, value);
continue continue

View file

@ -1121,7 +1121,7 @@ impl InlineFlow {
let run = Arc::make_unique(&mut scanned_text_fragment_info.run); let run = Arc::make_unique(&mut scanned_text_fragment_info.run);
{ {
let glyph_runs = Arc::make_unique(&mut run.glyphs); let glyph_runs = Arc::make_unique(&mut run.glyphs);
for mut glyph_run in glyph_runs.iter_mut() { for mut glyph_run in &mut *glyph_runs {
let mut range = glyph_run.range.intersect(&fragment_range); let mut range = glyph_run.range.intersect(&fragment_range);
if range.is_empty() { if range.is_empty() {
continue continue
@ -1226,7 +1226,7 @@ impl InlineFlow {
for frag in &self.fragments.fragments { for frag in &self.fragments.fragments {
match frag.inline_context { match frag.inline_context {
Some(ref inline_context) => { Some(ref inline_context) => {
for node in inline_context.nodes.iter() { for node in &inline_context.nodes {
let font_style = node.style.get_font_arc(); let font_style = node.style.get_font_arc();
let font_metrics = text::font_metrics_for_style(font_context, font_style); let font_metrics = text::font_metrics_for_style(font_context, font_style);
let line_height = text::line_height_from_style(&*node.style, &font_metrics); let line_height = text::line_height_from_style(&*node.style, &font_metrics);

View file

@ -114,7 +114,7 @@ pub trait ParallelPreorderDomTraversal : PreorderDomTraversal {
top_down_func: ChunkedDomTraversalFunction, top_down_func: ChunkedDomTraversalFunction,
bottom_up_func: DomTraversalFunction) { bottom_up_func: DomTraversalFunction) {
let mut discovered_child_nodes = Vec::new(); let mut discovered_child_nodes = Vec::new();
for unsafe_node in unsafe_nodes.0.into_iter() { for unsafe_node in *unsafe_nodes.0 {
// Get a real layout node. // Get a real layout node.
let node: LayoutNode = unsafe { let node: LayoutNode = unsafe {
layout_node_from_unsafe_layout_node(&unsafe_node) layout_node_from_unsafe_layout_node(&unsafe_node)
@ -295,7 +295,7 @@ trait ParallelPreorderFlowTraversal : PreorderFlowTraversal {
top_down_func: ChunkedFlowTraversalFunction, top_down_func: ChunkedFlowTraversalFunction,
bottom_up_func: FlowTraversalFunction) { bottom_up_func: FlowTraversalFunction) {
let mut discovered_child_flows = Vec::new(); let mut discovered_child_flows = Vec::new();
for mut unsafe_flow in unsafe_flows.0.into_iter() { for mut unsafe_flow in *unsafe_flows.0 {
let mut had_children = false; let mut had_children = false;
unsafe { unsafe {
// Get a real flow. // Get a real flow.

View file

@ -282,7 +282,7 @@ impl ImageCache {
let completed_load = CompletedLoad::new(image_response.clone()); let completed_load = CompletedLoad::new(image_response.clone());
self.completed_loads.insert(url, completed_load); self.completed_loads.insert(url, completed_load);
for listener in pending_load.listeners.into_iter() { for listener in pending_load.listeners {
listener.notify(image_response.clone()); listener.notify(image_response.clone());
} }
} }

View file

@ -212,7 +212,7 @@ impl ResourceManager {
fn set_cookies_for_url(&mut self, request: Url, cookie_list: String, source: CookieSource) { fn set_cookies_for_url(&mut self, request: Url, cookie_list: String, source: CookieSource) {
let header = Header::parse_header(&[cookie_list.into_bytes()]); let header = Header::parse_header(&[cookie_list.into_bytes()]);
if let Ok(SetCookie(cookies)) = header { if let Ok(SetCookie(cookies)) = header {
for bare_cookie in cookies.into_iter() { for bare_cookie in cookies {
if let Some(cookie) = cookie::Cookie::new_wrapped(bare_cookie, &request, source) { if let Some(cookie) = cookie::Cookie::new_wrapped(bare_cookie, &request, source) {
self.cookie_storage.push(cookie, source); self.cookie_storage.push(cookie, source);
} }

View file

@ -212,7 +212,7 @@ impl JSTraceable for Heap<JSVal> {
impl<T: JSTraceable> JSTraceable for Vec<T> { impl<T: JSTraceable> JSTraceable for Vec<T> {
#[inline] #[inline]
fn trace(&self, trc: *mut JSTracer) { fn trace(&self, trc: *mut JSTracer) {
for e in self.iter() { for e in &*self {
e.trace(trc); e.trace(trc);
} }
} }
@ -254,7 +254,7 @@ impl<K, V, S> JSTraceable for HashMap<K, V, S>
{ {
#[inline] #[inline]
fn trace(&self, trc: *mut JSTracer) { fn trace(&self, trc: *mut JSTracer) {
for (k, v) in self.iter() { for (k, v) in &*self {
k.trace(trc); k.trace(trc);
v.trace(trc); v.trace(trc);
} }

View file

@ -677,7 +677,7 @@ pub unsafe fn finalize_global(obj: *mut JSObject) {
/// Trace the resources held by reserved slots of a global object /// Trace the resources held by reserved slots of a global object
pub unsafe fn trace_global(tracer: *mut JSTracer, obj: *mut JSObject) { pub unsafe fn trace_global(tracer: *mut JSTracer, obj: *mut JSObject) {
let array = get_proto_or_iface_array(obj); let array = get_proto_or_iface_array(obj);
for proto in (&*array).iter() { for proto in (*array).iter() {
if !proto.is_null() { if !proto.is_null() {
trace_object(tracer, "prototype", &*(proto as *const *mut JSObject as *const Heap<*mut JSObject>)); trace_object(tracer, "prototype", &*(proto as *const *mut JSObject as *const Heap<*mut JSObject>));
} }

View file

@ -162,7 +162,7 @@ impl<'a> CSSStyleDeclarationMethods for &'a CSSStyleDeclaration {
let mut list = vec!(); let mut list = vec!();
// Step 2.2 // Step 2.2
for longhand in longhand_properties.iter() { for longhand in &*longhand_properties {
// Step 2.2.1 // Step 2.2.1
let declaration = owner.get_declaration(&Atom::from_slice(&longhand)); let declaration = owner.get_declaration(&Atom::from_slice(&longhand));
@ -327,7 +327,7 @@ impl<'a> CSSStyleDeclarationMethods for &'a CSSStyleDeclaration {
match longhands_from_shorthand(&property) { match longhands_from_shorthand(&property) {
// Step 4 // Step 4
Some(longhands) => { Some(longhands) => {
for longhand in longhands.iter() { for longhand in &*longhands {
elem.remove_inline_style_property(longhand) elem.remove_inline_style_property(longhand)
} }
} }

View file

@ -899,7 +899,7 @@ impl<'a> DocumentHelpers<'a> for &'a Document {
} }
} else { } else {
let fragment = NodeCast::from_root(self.CreateDocumentFragment()); let fragment = NodeCast::from_root(self.CreateDocumentFragment());
for node in nodes.into_iter() { for node in nodes {
match node { match node {
NodeOrString::eNode(node) => { NodeOrString::eNode(node) => {
try!(fragment.r().AppendChild(node.r())); try!(fragment.r().AppendChild(node.r()));

View file

@ -685,7 +685,7 @@ impl<'a> ElementHelpers<'a> for &'a Element {
// Usually, the reference count will be 1 here. But transitions could make it greater // Usually, the reference count will be 1 here. But transitions could make it greater
// than that. // than that.
let existing_declarations = Arc::make_unique(existing_declarations); let existing_declarations = Arc::make_unique(existing_declarations);
for declaration in existing_declarations.iter_mut() { for declaration in &mut *existing_declarations {
if declaration.name() == property_decl.name() { if declaration.name() == property_decl.name() {
*declaration = property_decl; *declaration = property_decl;
return; return;

View file

@ -70,8 +70,8 @@ pub fn dispatch_event<'a, 'b>(target: &'a EventTarget,
event.set_current_target(target.clone()); event.set_current_target(target.clone());
let opt_listeners = target.get_listeners(&type_); let opt_listeners = target.get_listeners(&type_);
for listeners in opt_listeners.iter() { for listeners in opt_listeners {
for listener in listeners.iter() { for listener in listeners {
// Explicitly drop any exception on the floor. // Explicitly drop any exception on the floor.
let _ = listener.HandleEvent_(target, event, Report); let _ = listener.HandleEvent_(target, event, Report);

View file

@ -332,8 +332,8 @@ impl<'a> EventTargetMethods for &'a EventTarget {
match listener { match listener {
Some(ref listener) => { Some(ref listener) => {
let mut handlers = self.handlers.borrow_mut(); let mut handlers = self.handlers.borrow_mut();
let mut entry = handlers.get_mut(&ty); let entry = handlers.get_mut(&ty);
for entry in entry.iter_mut() { for entry in entry {
let phase = if capture { ListenerPhase::Capturing } else { ListenerPhase::Bubbling }; let phase = if capture { ListenerPhase::Capturing } else { ListenerPhase::Bubbling };
let old_entry = EventListenerEntry { let old_entry = EventListenerEntry {
phase: phase, phase: phase,

View file

@ -1867,7 +1867,7 @@ impl Node {
let copy_elem = ElementCast::to_ref(copy.r()).unwrap(); let copy_elem = ElementCast::to_ref(copy.r()).unwrap();
let window = document.r().window(); let window = document.r().window();
for ref attr in node_elem.attrs().iter() { for ref attr in &*node_elem.attrs() {
let attr = attr.root(); let attr = attr.root();
let newattr = let newattr =
Attr::new(window.r(), Attr::new(window.r(),

View file

@ -179,7 +179,7 @@ impl<'a> WorkerGlobalScopeMethods for &'a WorkerGlobalScope {
// https://html.spec.whatwg.org/multipage/#dom-workerglobalscope-importscripts // https://html.spec.whatwg.org/multipage/#dom-workerglobalscope-importscripts
fn ImportScripts(self, url_strings: Vec<DOMString>) -> ErrorResult { fn ImportScripts(self, url_strings: Vec<DOMString>) -> ErrorResult {
let mut urls = Vec::with_capacity(url_strings.len()); let mut urls = Vec::with_capacity(url_strings.len());
for url in url_strings.into_iter() { for url in url_strings {
let url = UrlParser::new().base_url(&self.worker_url) let url = UrlParser::new().base_url(&self.worker_url)
.parse(&url); .parse(&url);
match url { match url {
@ -188,7 +188,7 @@ impl<'a> WorkerGlobalScopeMethods for &'a WorkerGlobalScope {
}; };
} }
for url in urls.into_iter() { for url in urls {
let (url, source) = match load_whole_resource(&self.resource_task, url) { let (url, source) = match load_whole_resource(&self.resource_task, url) {
Err(_) => return Err(Network), Err(_) => return Err(Network),
Ok((metadata, bytes)) => { Ok((metadata, bytes)) => {

View file

@ -46,7 +46,7 @@ impl IterablePage for Rc<Page> {
} }
fn find(&self, id: PipelineId) -> Option<Rc<Page>> { fn find(&self, id: PipelineId) -> Option<Rc<Page>> {
if self.id == id { return Some(self.clone()); } if self.id == id { return Some(self.clone()); }
for page in self.children.borrow().iter() { for page in &*self.children.borrow() {
let found = page.find(id); let found = page.find(id);
if found.is_some() { return found; } if found.is_some() { return found; }
} }
@ -104,7 +104,7 @@ impl Iterator for PageIterator {
fn next(&mut self) -> Option<Rc<Page>> { fn next(&mut self) -> Option<Rc<Page>> {
match self.stack.pop() { match self.stack.pop() {
Some(next) => { Some(next) => {
for child in next.children.borrow().iter() { for child in &*next.children.borrow() {
self.stack.push(child.clone()); self.stack.push(child.clone());
} }
Some(next) Some(next)

View file

@ -90,7 +90,7 @@ impl<'a> TreeSink for servohtmlparser::Sink {
let elem = Element::create(name, None, doc.r(), let elem = Element::create(name, None, doc.r(),
ElementCreator::ParserCreated); ElementCreator::ParserCreated);
for attr in attrs.into_iter() { for attr in attrs {
elem.r().set_attribute_from_parser(attr.name, attr.value.into(), None); elem.r().set_attribute_from_parser(attr.name, attr.value.into(), None);
} }
@ -152,7 +152,7 @@ impl<'a> TreeSink for servohtmlparser::Sink {
let node: Root<Node> = target.root(); let node: Root<Node> = target.root();
let elem = ElementCast::to_ref(node.r()) let elem = ElementCast::to_ref(node.r())
.expect("tried to set attrs on non-Element in HTML parsing"); .expect("tried to set attrs on non-Element in HTML parsing");
for attr in attrs.into_iter() { for attr in attrs {
elem.set_attribute_from_parser(attr.name, attr.value.into(), None); elem.set_attribute_from_parser(attr.name, attr.value.into(), None);
} }
} }

View file

@ -709,7 +709,7 @@ impl ScriptTask {
} }
} }
for (id, size) in resizes.into_iter() { for (id, size) in resizes {
self.handle_event(id, ResizeEvent(size)); self.handle_event(id, ResizeEvent(size));
} }
@ -814,7 +814,7 @@ impl ScriptTask {
} }
// Process the gathered events. // Process the gathered events.
for msg in sequential.into_iter() { for msg in sequential {
match msg { match msg {
MixedMessage::FromConstellation(ConstellationControlMsg::ExitPipeline(id, exit_type)) => { MixedMessage::FromConstellation(ConstellationControlMsg::ExitPipeline(id, exit_type)) => {
if self.handle_exit_pipeline_msg(id, exit_type) { if self.handle_exit_pipeline_msg(id, exit_type) {
@ -1652,7 +1652,7 @@ impl ScriptTask {
let document = page.document(); let document = page.document();
let mut prev_mouse_over_targets: RootedVec<JS<Node>> = RootedVec::new(); let mut prev_mouse_over_targets: RootedVec<JS<Node>> = RootedVec::new();
for target in self.mouse_over_targets.borrow_mut().iter() { for target in &*self.mouse_over_targets.borrow_mut() {
prev_mouse_over_targets.push(target.clone()); prev_mouse_over_targets.push(target.clone());
} }
@ -1663,7 +1663,7 @@ impl ScriptTask {
document.r().handle_mouse_move_event(self.js_runtime.rt(), point, &mut mouse_over_targets); document.r().handle_mouse_move_event(self.js_runtime.rt(), point, &mut mouse_over_targets);
// Notify Constellation about anchors that are no longer mouse over targets. // Notify Constellation about anchors that are no longer mouse over targets.
for target in prev_mouse_over_targets.iter() { for target in &*prev_mouse_over_targets {
if !mouse_over_targets.contains(target) { if !mouse_over_targets.contains(target) {
if target.root().r().is_anchor_element() { if target.root().r().is_anchor_element() {
let event = ConstellationMsg::NodeStatus(None); let event = ConstellationMsg::NodeStatus(None);
@ -1675,7 +1675,7 @@ impl ScriptTask {
} }
// Notify Constellation about the topmost anchor mouse over target. // Notify Constellation about the topmost anchor mouse over target.
for target in mouse_over_targets.iter() { for target in &*mouse_over_targets {
let target = target.root(); let target = target.root();
if target.r().is_anchor_element() { if target.r().is_anchor_element() {
let element = ElementCast::to_ref(target.r()).unwrap(); let element = ElementCast::to_ref(target.r()).unwrap();
@ -1936,7 +1936,7 @@ fn shut_down_layout(page_tree: &Rc<Page>, exit_type: PipelineExitType) {
} }
// Destroy the layout task. If there were node leaks, layout will now crash safely. // Destroy the layout task. If there were node leaks, layout will now crash safely.
for chan in channels.into_iter() { for chan in channels {
chan.send(layout_interface::Msg::ExitNow(exit_type)).ok(); chan.send(layout_interface::Msg::ExitNow(exit_type)).ok();
} }
} }

View file

@ -83,7 +83,7 @@ pub struct TimerManager {
impl Drop for TimerManager { impl Drop for TimerManager {
fn drop(&mut self) { fn drop(&mut self) {
for (_, timer_handle) in self.active_timers.borrow_mut().iter_mut() { for (_, timer_handle) in &mut *self.active_timers.borrow_mut() {
timer_handle.cancel(); timer_handle.cancel();
} }
} }
@ -125,12 +125,12 @@ impl TimerManager {
} }
pub fn suspend(&self) { pub fn suspend(&self) {
for (_, timer_handle) in self.active_timers.borrow_mut().iter_mut() { for (_, timer_handle) in &mut *self.active_timers.borrow_mut() {
timer_handle.suspend(); timer_handle.suspend();
} }
} }
pub fn resume(&self) { pub fn resume(&self) {
for (_, timer_handle) in self.active_timers.borrow_mut().iter_mut() { for (_, timer_handle) in &mut *self.active_timers.borrow_mut() {
timer_handle.resume(); timer_handle.resume();
} }
} }

View file

@ -5429,7 +5429,7 @@ pub mod shorthands {
let results = try!(input.parse_comma_separated(parse_one_transition)); let results = try!(input.parse_comma_separated(parse_one_transition));
let (mut properties, mut durations) = (Vec::new(), Vec::new()); let (mut properties, mut durations) = (Vec::new(), Vec::new());
let (mut timing_functions, mut delays) = (Vec::new(), Vec::new()); let (mut timing_functions, mut delays) = (Vec::new(), Vec::new());
for result in results.into_iter() { for result in results {
properties.push(result.transition_property); properties.push(result.transition_property);
durations.push(result.transition_duration); durations.push(result.transition_duration);
timing_functions.push(result.transition_timing_function); timing_functions.push(result.transition_timing_function);

View file

@ -227,7 +227,7 @@ pub fn get_null_window_handle() -> cef_window_handle_t {
pub fn update() { pub fn update() {
BROWSERS.with(|browsers| { BROWSERS.with(|browsers| {
for browser in browsers.borrow().iter() { for browser in &browsers.borrow() {
if browser.downcast().callback_executed.get() == false { if browser.downcast().callback_executed.get() == false {
browser_callback_after_created(browser.clone()); browser_callback_after_created(browser.clone());
} }

View file

@ -59,7 +59,7 @@ pub extern "C" fn command_line_get_switch_value(cmd: *mut cef_command_line_t, na
let slice = slice::from_raw_parts(buf, (*cs).length as usize); let slice = slice::from_raw_parts(buf, (*cs).length as usize);
let opt = String::from_utf16(slice).unwrap(); let opt = String::from_utf16(slice).unwrap();
//debug!("opt: {}", opt); //debug!("opt: {}", opt);
for s in (*cl).argv.iter() { for s in &(*cl).argv {
let o = s.trim_left_matches('-'); let o = s.trim_left_matches('-');
//debug!("arg: {}", o); //debug!("arg: {}", o);
if o.starts_with(&opt) { if o.starts_with(&opt) {
@ -104,4 +104,3 @@ cef_stub_static_method_impls! {
fn cef_command_line_create_command_line() -> *mut cef_command_line_t fn cef_command_line_create_command_line() -> *mut cef_command_line_t
fn cef_command_line_get_global_command_line() -> *mut cef_command_line_t fn cef_command_line_get_global_command_line() -> *mut cef_command_line_t
} }

View file

@ -82,7 +82,7 @@ pub extern "C" fn cef_string_multimap_key(smm: *mut cef_string_multimap_t, index
if index < 0 || smm.is_null() { return 0; } if index < 0 || smm.is_null() { return 0; }
let mut rem = index as usize; let mut rem = index as usize;
for (key, val) in (*smm).iter() { for (key, val) in &(*smm) {
if rem < (*val).len() { if rem < (*val).len() {
return cef_string_utf16_set((*key).as_bytes().as_ptr() as *const u16, return cef_string_utf16_set((*key).as_bytes().as_ptr() as *const u16,
(*key).len() as u64, (*key).len() as u64,