diff options
author | Keegan McAllister <kmcallister@mozilla.com> | 2014-09-18 16:29:46 -0700 |
---|---|---|
committer | Keegan McAllister <kmcallister@mozilla.com> | 2014-09-20 13:00:55 -0700 |
commit | dc86e8365495acc87b983a290bb7277a37a5247f (patch) | |
tree | 36af9677f6a24d7163e4b41c2b8e53da4d15538c /components | |
parent | 2f46b9aedefae7938102f7a1ccc6c96044cf1bdb (diff) | |
download | servo-dc86e8365495acc87b983a290bb7277a37a5247f.tar.gz servo-dc86e8365495acc87b983a290bb7277a37a5247f.zip |
Eliminate warnings
Diffstat (limited to 'components')
57 files changed, 223 insertions, 221 deletions
diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index 0fd8b3b976c..cec9c2b7419 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -317,7 +317,7 @@ impl IOCompositor { } (Ok(Paint(pipeline_id, epoch, replies)), NotShuttingDown) => { - for (layer_id, new_layer_buffer_set) in replies.move_iter() { + for (layer_id, new_layer_buffer_set) in replies.into_iter() { self.paint(pipeline_id, layer_id, new_layer_buffer_set, epoch); } self.remove_outstanding_render_msg(); @@ -839,7 +839,7 @@ impl IOCompositor { let mut results: HashMap<PipelineId, (RenderChan, Vec<RenderRequest>)> = HashMap::new(); - for (layer, mut layer_requests) in requests.move_iter() { + for (layer, mut layer_requests) in requests.into_iter() { let pipeline_id = layer.extra_data.borrow().pipeline.id; let &(_, ref mut vec) = results.find_or_insert_with(pipeline_id, |_| { (layer.extra_data.borrow().pipeline.render_chan.clone(), Vec::new()) @@ -847,7 +847,7 @@ impl IOCompositor { // All the BufferRequests are in layer/device coordinates, but the render task // wants to know the page coordinates. We scale them before sending them. - for request in layer_requests.mut_iter() { + for request in layer_requests.iter_mut() { request.page_rect = request.page_rect / scale.get(); } @@ -895,7 +895,7 @@ impl IOCompositor { self.convert_buffer_requests_to_pipeline_requests_map(layers_and_requests); let mut num_render_msgs_sent = 0; - for (_pipeline_id, (chan, requests)) in pipeline_requests.move_iter() { + for (_pipeline_id, (chan, requests)) in pipeline_requests.into_iter() { num_render_msgs_sent += 1; let _ = chan.send_opt(RenderMsg(requests)); } @@ -949,7 +949,7 @@ impl IOCompositor { // We must read from the back buffer (ie, before self.window.present()) as // OpenGL ES 2 does not have glReadBuffer(). let (width, height) = (self.window_size.width.get(), self.window_size.height.get()); - let path = from_str::<Path>(self.opts.output_file.get_ref().as_slice()).unwrap(); + let path = from_str::<Path>(self.opts.output_file.as_ref().unwrap().as_slice()).unwrap(); let mut pixels = gl2::read_pixels(0, 0, width as gl2::GLsizei, height as gl2::GLsizei, @@ -962,7 +962,7 @@ impl IOCompositor { let src_start = (height - y - 1) * stride; unsafe { let src_slice = orig_pixels.slice(src_start, src_start + stride); - pixels.mut_slice(dst_start, dst_start + stride) + pixels.slice_mut(dst_start, dst_start + stride) .copy_memory(src_slice.slice_to(stride)); } } diff --git a/components/compositing/compositor_data.rs b/components/compositing/compositor_data.rs index dfd58f5d2b6..bbb46603f6a 100644 --- a/components/compositing/compositor_data.rs +++ b/components/compositing/compositor_data.rs @@ -126,7 +126,7 @@ impl CompositorData { } { - for buffer in new_buffers.buffers.move_iter().rev() { + for buffer in new_buffers.buffers.into_iter().rev() { layer.add_buffer(buffer); } @@ -149,7 +149,7 @@ impl CompositorData { // We have no way of knowing without a race whether the render task is even up and // running, but mark the buffers as not leaking. If the render task died, then the // buffers are going to be cleaned up. - for buffer in buffers.mut_iter() { + for buffer in buffers.iter_mut() { buffer.mark_wont_leak() } @@ -173,7 +173,7 @@ impl CompositorData { /// This is used during shutdown, when we know the render task is going away. pub fn forget_all_tiles(layer: Rc<Layer<CompositorData>>) { let tiles = layer.collect_buffers(); - for tile in tiles.move_iter() { + for tile in tiles.into_iter() { let mut tile = tile; tile.mark_wont_leak() } diff --git a/components/compositing/constellation.rs b/components/compositing/constellation.rs index 70b7e387773..b1926fdfdea 100644 --- a/components/compositing/constellation.rs +++ b/components/compositing/constellation.rs @@ -116,9 +116,9 @@ impl FrameTreeTraversal for Rc<FrameTree> { fn replace_child(&self, id: PipelineId, new_child: Rc<FrameTree>) -> ReplaceResult { for frame_tree in self.iter() { let mut children = frame_tree.children.borrow_mut(); - let mut child = children.mut_iter() + let mut child = children.iter_mut() .find(|child| child.frame_tree.pipeline.id == id); - for child in child.mut_iter() { + for child in child.iter_mut() { *new_child.parent.borrow_mut() = child.frame_tree.parent.borrow().clone(); return ReplacedNode(replace(&mut child.frame_tree, new_child)); } @@ -153,7 +153,7 @@ impl Iterator<Rc<FrameTree>> for FrameTreeIterator { fn next(&mut self) -> Option<Rc<FrameTree>> { if !self.stack.is_empty() { let next = self.stack.pop(); - for cft in next.get_ref().children.borrow().iter() { + for cft in next.as_ref().unwrap().children.borrow().iter() { self.stack.push(cft.frame_tree.clone()); } Some(next.unwrap()) @@ -190,14 +190,14 @@ impl NavigationContext { * when it is known that there exists either a previous page or a next page. */ fn back(&mut self) -> Rc<FrameTree> { - self.next.push(self.current.take_unwrap()); + self.next.push(self.current.take().unwrap()); let prev = self.previous.pop().unwrap(); self.current = Some(prev.clone()); prev } fn forward(&mut self) -> Rc<FrameTree> { - self.previous.push(self.current.take_unwrap()); + self.previous.push(self.current.take().unwrap()); let next = self.next.pop().unwrap(); self.current = Some(next.clone()); next @@ -208,7 +208,7 @@ impl NavigationContext { debug!("navigating to {:?}", frame_tree.pipeline.id); let evicted = replace(&mut self.next, vec!()); if self.current.is_some() { - self.previous.push(self.current.take_unwrap()); + self.previous.push(self.current.take().unwrap()); } self.current = Some(frame_tree.clone()); evicted @@ -333,7 +333,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> { let matching_pending_frames = self.pending_frames.iter().filter_map(|frame_change| { frame_change.after.find(pipeline_id) }); - matching_navi_frames.move_iter().chain(matching_pending_frames).collect() + matching_navi_frames.into_iter().chain(matching_pending_frames).collect() } /// Handles loading pages, navigation, and granting access to the compositor @@ -527,7 +527,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> { let source_frame = current_frame.find(pipeline_id); for source_frame in source_frame.iter() { let mut children = source_frame.children.borrow_mut(); - let found_child = children.mut_iter().find(|child| subpage_eq(child)); + let found_child = children.iter_mut().find(|child| subpage_eq(child)); found_child.map(|child| update_child_rect(child, true)); } } @@ -535,7 +535,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> { // Update all frames with matching pipeline- and subpage-ids for frame_tree in frames.iter() { let mut children = frame_tree.children.borrow_mut(); - let found_child = children.mut_iter().find(|child| subpage_eq(child)); + let found_child = children.iter_mut().find(|child| subpage_eq(child)); found_child.map(|child| update_child_rect(child, false)); } } @@ -612,7 +612,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> { fn handle_load_url_msg(&mut self, source_id: PipelineId, url: Url) { debug!("Constellation: received message to load {:s}", url.to_string()); // Make sure no pending page would be overridden. - let source_frame = self.current_frame().get_ref().find(source_id).expect( + let source_frame = self.current_frame().as_ref().unwrap().find(source_id).expect( "Constellation: received a LoadUrlMsg from a pipeline_id associated with a pipeline not in the active frame tree. This should be impossible."); @@ -621,7 +621,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> { let old_id = frame_change.before.expect("Constellation: Received load msg from pipeline, but there is no currently active page. This should be impossible."); - let changing_frame = self.current_frame().get_ref().find(old_id).expect("Constellation: + let changing_frame = self.current_frame().as_ref().unwrap().find(old_id).expect("Constellation: Pending change has non-active source pipeline. This should be impossible."); if changing_frame.contains(source_id) || source_frame.contains(old_id) { @@ -663,7 +663,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> { debug!("no next page to navigate to"); return; } else { - let old = self.current_frame().get_ref(); + let old = self.current_frame().as_ref().unwrap(); for frame in old.iter() { frame.pipeline.revoke_paint_permission(); } @@ -675,7 +675,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> { debug!("no previous page to navigate to"); return; } else { - let old = self.current_frame().get_ref(); + let old = self.current_frame().as_ref().unwrap(); for frame in old.iter() { frame.pipeline.revoke_paint_permission(); } @@ -721,7 +721,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> { // Create the next frame tree that will be given to the compositor let next_frame_tree = if to_add.parent.borrow().is_some() { // NOTE: work around borrowchk issues - self.current_frame().get_ref().clone() + self.current_frame().as_ref().unwrap().clone() } else { to_add.clone() }; @@ -730,7 +730,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> { match frame_change.before { Some(revoke_id) if self.current_frame().is_some() => { debug!("Constellation: revoking permission from {:?}", revoke_id); - let current_frame = self.current_frame().get_ref(); + let current_frame = self.current_frame().as_ref().unwrap(); let to_revoke = current_frame.find(revoke_id).expect( "Constellation: pending frame change refers to an old \ diff --git a/components/gfx/buffer_map.rs b/components/gfx/buffer_map.rs index 0551385f717..79612f6a9bd 100644 --- a/components/gfx/buffer_map.rs +++ b/components/gfx/buffer_map.rs @@ -103,7 +103,7 @@ impl BufferMap { }; if { let list = &mut self.map.get_mut(&old_key).buffers; - let condemned_buffer = list.pop().take_unwrap(); + let condemned_buffer = list.pop().take().unwrap(); self.mem -= condemned_buffer.get_mem(); condemned_buffer.destroy(graphics_context); list.is_empty() @@ -126,7 +126,7 @@ impl BufferMap { buffer_val.last_action = self.counter; self.counter += 1; - let buffer = buffer_val.buffers.pop().take_unwrap(); + let buffer = buffer_val.buffers.pop().take().unwrap(); self.mem -= buffer.get_mem(); if buffer_val.buffers.is_empty() { flag = true; @@ -146,8 +146,8 @@ impl BufferMap { /// Destroys all buffers. pub fn clear(&mut self, graphics_context: &NativePaintingGraphicsContext) { let map = mem::replace(&mut self.map, HashMap::new()); - for (_, value) in map.move_iter() { - for tile in value.buffers.move_iter() { + for (_, value) in map.into_iter() { + for tile in value.buffers.into_iter() { tile.destroy(graphics_context) } } diff --git a/components/gfx/display_list/mod.rs b/components/gfx/display_list/mod.rs index ba2e69e40f5..bb274e74672 100644 --- a/components/gfx/display_list/mod.rs +++ b/components/gfx/display_list/mod.rs @@ -198,7 +198,7 @@ impl StackingContext { positioned_descendants: Vec::new(), }; - for item in list.move_iter() { + for item in list.into_iter() { match item { ClipDisplayItemClass(box ClipDisplayItem { base: base, @@ -219,7 +219,7 @@ impl StackingContext { ContentStackingLevel => stacking_context.content.push(item), PositionedDescendantStackingLevel(z_index) => { match stacking_context.positioned_descendants - .mut_iter() + .iter_mut() .find(|& &(z, _)| z_index == z) { Some(&(_, ref mut my_list)) => { my_list.push(item); @@ -270,9 +270,9 @@ impl StackingContext { push(&mut self.floats, floats, FloatStackingLevel); push(&mut self.content, content, ContentStackingLevel); - for (z_index, list) in positioned_descendants.move_iter() { + for (z_index, list) in positioned_descendants.into_iter() { match self.positioned_descendants - .mut_iter() + .iter_mut() .find(|& &(existing_z_index, _)| z_index == existing_z_index) { Some(&(_, ref mut existing_list)) => { push(existing_list, list, PositionedDescendantStackingLevel(z_index)); @@ -386,7 +386,7 @@ impl DisplayList { // TODO(pcwalton): Sort positioned children according to z-index. // Step 3: Positioned descendants with negative z-indices. - for &(ref mut z_index, ref mut list) in positioned_descendants.mut_iter() { + for &(ref mut z_index, ref mut list) in positioned_descendants.iter_mut() { if *z_index < 0 { result.push_all_move(mem::replace(list, DisplayList::new())) } @@ -404,7 +404,7 @@ impl DisplayList { result.push_all_move(content); // Steps 8 and 9: Positioned descendants with nonnegative z-indices. - for &(ref mut z_index, ref mut list) in positioned_descendants.mut_iter() { + for &(ref mut z_index, ref mut list) in positioned_descendants.iter_mut() { if *z_index >= 0 { result.push_all_move(mem::replace(list, DisplayList::new())) } @@ -418,7 +418,7 @@ impl DisplayList { /// Sets the stacking level for this display list and all its subitems. fn set_stacking_level(&mut self, new_level: StackingLevel) { - for item in self.list.mut_iter() { + for item in self.list.iter_mut() { item.mut_base().level = new_level; match item.mut_sublist() { None => {} diff --git a/components/gfx/font.rs b/components/gfx/font.rs index 74930da0b4a..5d4af74d0a9 100644 --- a/components/gfx/font.rs +++ b/components/gfx/font.rs @@ -115,7 +115,7 @@ impl Font { let shaper = &self.shaper; self.shape_cache.find_or_create(&text, |txt| { let mut glyphs = GlyphStore::new(text.as_slice().char_len() as int, is_whitespace); - shaper.get_ref().shape_text(txt.as_slice(), &mut glyphs); + shaper.as_ref().unwrap().shape_text(txt.as_slice(), &mut glyphs); Arc::new(glyphs) }) } @@ -132,7 +132,7 @@ impl Font { let shaper = Shaper::new(self); self.shaper = Some(shaper); - self.shaper.get_ref() + self.shaper.as_ref().unwrap() } pub fn get_table_for_tag(&self, tag: FontTableTag) -> Option<FontTable> { diff --git a/components/gfx/font_cache_task.rs b/components/gfx/font_cache_task.rs index 9dd453fa8a2..59fcd4146b9 100644 --- a/components/gfx/font_cache_task.rs +++ b/components/gfx/font_cache_task.rs @@ -36,7 +36,7 @@ impl FontFamily { // TODO(Issue #190): if not in the fast path above, do // expensive matching of weights, etc. - for template in self.templates.mut_iter() { + for template in self.templates.iter_mut() { let maybe_template = template.get_if_matches(fctx, desc); if maybe_template.is_some() { return maybe_template; @@ -46,7 +46,7 @@ impl FontFamily { // If a request is made for a font family that exists, // pick the first valid font in the family if we failed // to find an exact match for the descriptor. - for template in self.templates.mut_iter() { + for template in self.templates.iter_mut() { let maybe_template = template.get(); if maybe_template.is_some() { return maybe_template; diff --git a/components/gfx/font_context.rs b/components/gfx/font_context.rs index 9a97e0178dd..3520da107f5 100644 --- a/components/gfx/font_context.rs +++ b/components/gfx/font_context.rs @@ -34,7 +34,7 @@ fn create_scaled_font(backend: BackendType, template: &Arc<FontTemplateData>, pt #[cfg(target_os="macos")] fn create_scaled_font(backend: BackendType, template: &Arc<FontTemplateData>, pt_size: f64) -> ScaledFont { - let cgfont = template.ctfont.get_ref().copy_to_CGFont(); + let cgfont = template.ctfont.as_ref().unwrap().copy_to_CGFont(); ScaledFont::new(backend, &cgfont, pt_size as AzFloat) } diff --git a/components/gfx/platform/freetype/font_list.rs b/components/gfx/platform/freetype/font_list.rs index d58cd08819c..2b6c85a4363 100644 --- a/components/gfx/platform/freetype/font_list.rs +++ b/components/gfx/platform/freetype/font_list.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#![allow(uppercase_variables)] +#![allow(non_snake_case)] extern crate freetype; extern crate fontconfig; diff --git a/components/gfx/render_task.rs b/components/gfx/render_task.rs index 6c4075cbd65..e19db054239 100644 --- a/components/gfx/render_task.rs +++ b/components/gfx/render_task.rs @@ -237,7 +237,7 @@ impl<C:RenderListener + Send> RenderTask<C> { let mut replies = Vec::new(); self.compositor.set_render_state(self.id, RenderingRenderState); for RenderRequest { buffer_requests, scale, layer_id, epoch } - in requests.move_iter() { + in requests.into_iter() { if self.epoch == epoch { self.render(&mut replies, buffer_requests, scale, layer_id); } else { @@ -251,7 +251,7 @@ impl<C:RenderListener + Send> RenderTask<C> { self.compositor.paint(self.id, self.epoch, replies); } UnusedBufferMsg(unused_buffers) => { - for buffer in unused_buffers.move_iter().rev() { + for buffer in unused_buffers.into_iter().rev() { self.buffer_map.insert(native_graphics_context!(self), buffer); } } diff --git a/components/gfx/text/glyph.rs b/components/gfx/text/glyph.rs index 5fcfb227a6c..4ae1ce13b95 100644 --- a/components/gfx/text/glyph.rs +++ b/components/gfx/text/glyph.rs @@ -156,8 +156,8 @@ fn is_simple_glyph_id(id: GlyphId) -> bool { } fn is_simple_advance(advance: Au) -> bool { - let unsignedAu = advance.to_u32().unwrap(); - (unsignedAu & (GLYPH_ADVANCE_MASK >> GLYPH_ADVANCE_SHIFT as uint)) == unsignedAu + let unsigned_au = advance.to_u32().unwrap(); + (unsigned_au & (GLYPH_ADVANCE_MASK >> GLYPH_ADVANCE_SHIFT as uint)) == unsigned_au } type DetailedGlyphCount = u16; @@ -700,7 +700,7 @@ impl<'a> GlyphIterator<'a> { // Slow path when there is a glyph range. #[inline(never)] fn next_glyph_range(&mut self) -> Option<(CharIndex, GlyphInfo<'a>)> { - match self.glyph_range.get_mut_ref().next() { + match self.glyph_range.as_mut().unwrap().next() { Some(j) => Some((self.char_index, DetailGlyphInfo(self.store, self.char_index, j.get() as u16 /* ??? */))), None => { diff --git a/components/gfx/text/shaping/harfbuzz.rs b/components/gfx/text/shaping/harfbuzz.rs index b2d01f1204c..f41ea82cf6d 100644 --- a/components/gfx/text/shaping/harfbuzz.rs +++ b/components/gfx/text/shaping/harfbuzz.rs @@ -241,15 +241,15 @@ impl Shaper { } // make map of what chars have glyphs - let mut byteToGlyph: Vec<i32>; + let mut byte_to_glyph: Vec<i32>; // fast path: all chars are single-byte. if byte_max == char_max { - byteToGlyph = Vec::from_elem(byte_max as uint, NO_GLYPH); + byte_to_glyph = Vec::from_elem(byte_max as uint, NO_GLYPH); } else { - byteToGlyph = Vec::from_elem(byte_max as uint, CONTINUATION_BYTE); + byte_to_glyph = Vec::from_elem(byte_max as uint, CONTINUATION_BYTE); for (i, _) in text.char_indices() { - *byteToGlyph.get_mut(i) = NO_GLYPH; + *byte_to_glyph.get_mut(i) = NO_GLYPH; } } @@ -258,10 +258,10 @@ impl Shaper { // loc refers to a *byte* offset within the utf8 string. let loc = glyph_data.byte_offset_of_glyph(i); if loc < byte_max { - assert!(*byteToGlyph.get(loc as uint) != CONTINUATION_BYTE); - *byteToGlyph.get_mut(loc as uint) = i as i32; + assert!(*byte_to_glyph.get(loc as uint) != CONTINUATION_BYTE); + *byte_to_glyph.get_mut(loc as uint) = i as i32; } else { - debug!("ERROR: tried to set out of range byteToGlyph: idx={}, glyph idx={}", + debug!("ERROR: tried to set out of range byte_to_glyph: idx={}, glyph idx={}", loc, i); } @@ -271,7 +271,7 @@ impl Shaper { debug!("text: {:s}", text); debug!("(char idx): char->(glyph index):"); for (i, ch) in text.char_indices() { - debug!("{}: {} --> {:d}", i, ch, *byteToGlyph.get(i) as int); + debug!("{}: {} --> {:d}", i, ch, *byte_to_glyph.get(i) as int); } // some helpers @@ -303,7 +303,7 @@ impl Shaper { char_byte_span.begin(), char_byte_span.length(), glyph_span.begin()); while char_byte_span.end() != byte_max && - byteToGlyph[char_byte_span.end() as uint] == NO_GLYPH { + byte_to_glyph[char_byte_span.end() as uint] == NO_GLYPH { debug!("Extending char byte span to include byte offset={} with no associated \ glyph", char_byte_span.end()); let range = text.char_range_at(char_byte_span.end() as uint); @@ -315,8 +315,8 @@ impl Shaper { // in cases where one char made several glyphs and left some unassociated chars. let mut max_glyph_idx = glyph_span.end(); for i in char_byte_span.each_index() { - if byteToGlyph[i as uint] > NO_GLYPH { - max_glyph_idx = cmp::max(byteToGlyph[i as uint] as int + 1, max_glyph_idx); + if byte_to_glyph[i as uint] > NO_GLYPH { + max_glyph_idx = cmp::max(byte_to_glyph[i as uint] as int + 1, max_glyph_idx); } } @@ -375,7 +375,7 @@ impl Shaper { let mut covered_byte_span = char_byte_span.clone(); // extend, clipping at end of text range. while covered_byte_span.end() < byte_max - && byteToGlyph[covered_byte_span.end() as uint] == NO_GLYPH { + && byte_to_glyph[covered_byte_span.end() as uint] == NO_GLYPH { let range = text.char_range_at(covered_byte_span.end() as uint); drop(range.ch); covered_byte_span.extend_to(range.next as int); diff --git a/components/gfx/text/text_run.rs b/components/gfx/text/text_run.rs index 70c10f1c64c..57ca437e4f2 100644 --- a/components/gfx/text/text_run.rs +++ b/components/gfx/text/text_run.rs @@ -104,7 +104,7 @@ impl<'a> Iterator<Range<CharIndex>> for LineIterator<'a> { None => { // flush any remaining chars as a line if self.clump.is_some() { - let mut c = self.clump.take_unwrap(); + let mut c = self.clump.take().unwrap(); c.extend_to(self.range.end()); return Some(c); } else { diff --git a/components/layout/block.rs b/components/layout/block.rs index 6f5f8ea6f57..fedca650919 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -753,7 +753,7 @@ impl BlockFlow { // Avoid copying the offset vector. let offsets = mem::replace(&mut kid_base.abs_descendants.static_b_offsets, Vec::new()); // Consume all the static y-offsets bubbled up by kid. - for y_offset in offsets.move_iter() { + for y_offset in offsets.into_iter() { // The offsets are wrt the kid flow box. Translate them to current flow. abs_descendant_y_offsets.push(y_offset + kid_base.position.start.b); } @@ -1046,15 +1046,15 @@ impl BlockFlow { self.fragment.border_padding.inline_start_end(), block_size + margin_block_size), ceiling: clearance + self.base.position.start.b, - max_inline_size: self.float.get_ref().containing_inline_size, - kind: self.float.get_ref().float_kind, + max_inline_size: self.float.as_ref().unwrap().containing_inline_size, + kind: self.float.as_ref().unwrap().float_kind, }; // Place the float and return the `Floats` back to the parent flow. // After, grab the position and use that to set our position. self.base.floats.add_float(&info); - self.float.get_mut_ref().rel_pos = self.base.floats.last_float_pos().unwrap(); + self.float.as_mut().unwrap().rel_pos = self.base.floats.last_float_pos().unwrap(); } /// Assign block-size for current flow. @@ -1185,7 +1185,7 @@ impl BlockFlow { } pub fn build_display_list_float(&mut self, layout_context: &LayoutContext) { - let float_offset = self.float.get_ref().rel_pos; + let float_offset = self.float.as_ref().unwrap().rel_pos; self.build_display_list_block_common(layout_context, float_offset, RootOfStackingContextLevel); @@ -1599,7 +1599,7 @@ impl Flow for BlockFlow { let containing_block_inline_size = self.base.position.size.inline; self.compute_used_inline_size(layout_context, containing_block_inline_size); if self.is_float() { - self.float.get_mut_ref().containing_inline_size = containing_block_inline_size; + self.float.as_mut().unwrap().containing_inline_size = containing_block_inline_size; } // Formatting contexts are never impacted by floats. @@ -1720,7 +1720,7 @@ impl Flow for BlockFlow { } let float_offset = if self.is_float() { - self.float.get_ref().rel_pos + self.float.as_ref().unwrap().rel_pos } else { LogicalPoint::zero(self.base.writing_mode) }; diff --git a/components/layout/construct.rs b/components/layout/construct.rs index 0cf5adf3254..12747c71377 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -173,7 +173,7 @@ impl InlineFragmentsAccumulator { match enclosing_style { Some(enclosing_style) => { - for frag in fragments.fragments.mut_iter() { + for frag in fragments.fragments.iter_mut() { frag.add_inline_context_style(enclosing_style.clone()); } } @@ -372,7 +372,7 @@ impl<'a> FlowConstructor<'a> { abs_descendants: kid_abs_descendants, })) => { // Add any {ib} splits. - for split in splits.move_iter() { + for split in splits.into_iter() { // Pull apart the {ib} split object and push its predecessor fragments // onto the list. let InlineBlockSplit { @@ -556,7 +556,7 @@ impl<'a> FlowConstructor<'a> { })) => { // Bubble up {ib} splits. - for split in splits.move_iter() { + for split in splits.into_iter() { let InlineBlockSplit { predecessors: predecessors, flow: kid_flow @@ -709,7 +709,7 @@ impl<'a> FlowConstructor<'a> { node: &ThreadSafeLayoutNode) { let mut anonymous_flow = flow.get().generate_missing_child_flow(node); let mut consecutive_siblings = vec!(); - for kid_flow in child_flows.move_iter() { + for kid_flow in child_flows.into_iter() { if anonymous_flow.get().need_anonymous_flow(kid_flow.get()) { consecutive_siblings.push(kid_flow); continue; diff --git a/components/layout/css/matching.rs b/components/layout/css/matching.rs index 039e176e843..6913b43bfc4 100644 --- a/components/layout/css/matching.rs +++ b/components/layout/css/matching.rs @@ -464,7 +464,7 @@ impl<'ln> MatchMethods for LayoutNode<'ln> { Some(shared_style) => { // Yay, cache hit. Share the style. let mut layout_data_ref = self.mutate_layout_data(); - layout_data_ref.get_mut_ref().shared_data.style = Some(shared_style); + layout_data_ref.as_mut().unwrap().shared_data.style = Some(shared_style); return StyleWasShared(i) } None => {} @@ -622,14 +622,14 @@ impl<'ln> MatchMethods for LayoutNode<'ln> { applicable_declarations_cache, applicable_declarations.normal_shareable); if applicable_declarations.before.len() > 0 { - self.cascade_node_pseudo_element(Some(layout_data.shared_data.style.get_ref()), + self.cascade_node_pseudo_element(Some(layout_data.shared_data.style.as_ref().unwrap()), applicable_declarations.before.as_slice(), &mut layout_data.data.before_style, applicable_declarations_cache, false); } if applicable_declarations.after.len() > 0 { - self.cascade_node_pseudo_element(Some(layout_data.shared_data.style.get_ref()), + self.cascade_node_pseudo_element(Some(layout_data.shared_data.style.as_ref().unwrap()), applicable_declarations.after.as_slice(), &mut layout_data.data.after_style, applicable_declarations_cache, diff --git a/components/layout/css/node_util.rs b/components/layout/css/node_util.rs index 150995428ea..dcf1019440e 100644 --- a/components/layout/css/node_util.rs +++ b/components/layout/css/node_util.rs @@ -57,7 +57,7 @@ impl<'ln> NodeUtil for ThreadSafeLayoutNode<'ln> { /// Does this node have a computed style yet? fn have_css_select_results(&self) -> bool { let layout_data_ref = self.borrow_layout_data(); - layout_data_ref.get_ref().shared_data.style.is_some() + layout_data_ref.as_ref().unwrap().shared_data.style.is_some() } /// Get the description of how to account for recent style changes. @@ -73,7 +73,7 @@ impl<'ln> NodeUtil for ThreadSafeLayoutNode<'ln> { let layout_data_ref = self.borrow_layout_data(); layout_data_ref - .get_ref() + .as_ref().unwrap() .data .restyle_damage .unwrap_or(default) diff --git a/components/layout/flow.rs b/components/layout/flow.rs index 743e08cfafa..8c49eae6357 100644 --- a/components/layout/flow.rs +++ b/components/layout/flow.rs @@ -355,7 +355,7 @@ pub fn mut_base<'a>(this: &'a mut Flow) -> &'a mut BaseFlow { /// Iterates over the children of this flow. pub fn child_iter<'a>(flow: &'a mut Flow) -> MutFlowListIterator<'a> { - mut_base(flow).children.mut_iter() + mut_base(flow).children.iter_mut() } pub trait ImmutableFlowUtils { @@ -610,7 +610,7 @@ impl Descendants { /// /// Ignore any static y offsets, because they are None before layout. pub fn push_descendants(&mut self, given_descendants: Descendants) { - for elem in given_descendants.descendant_links.move_iter() { + for elem in given_descendants.descendant_links.into_iter() { self.descendant_links.push(elem); } } @@ -618,16 +618,16 @@ impl Descendants { /// Return an iterator over the descendant flows. pub fn iter<'a>(&'a mut self) -> DescendantIter<'a> { DescendantIter { - iter: self.descendant_links.mut_slice_from(0).mut_iter(), + iter: self.descendant_links.slice_from_mut(0).iter_mut(), } } /// Return an iterator over (descendant, static y offset). pub fn iter_with_offset<'a>(&'a mut self) -> DescendantOffsetIter<'a> { let descendant_iter = DescendantIter { - iter: self.descendant_links.mut_slice_from(0).mut_iter(), + iter: self.descendant_links.slice_from_mut(0).iter_mut(), }; - descendant_iter.zip(self.static_b_offsets.mut_slice_from(0).mut_iter()) + descendant_iter.zip(self.static_b_offsets.slice_from_mut(0).iter_mut()) } } @@ -824,7 +824,7 @@ impl BaseFlow { } pub fn child_iter<'a>(&'a mut self) -> MutFlowListIterator<'a> { - self.children.mut_iter() + self.children.iter_mut() } pub unsafe fn ref_count<'a>(&'a self) -> &'a AtomicUint { diff --git a/components/layout/flow_list.rs b/components/layout/flow_list.rs index 8b76f6b3c52..59259078963 100644 --- a/components/layout/flow_list.rs +++ b/components/layout/flow_list.rs @@ -63,7 +63,7 @@ impl FlowList { /// Add an element first in the list /// /// O(1) - pub fn push_front(&mut self, mut new_head: FlowRef) { + pub fn push_front(&mut self, new_head: FlowRef) { self.flows.push_front(new_head); } @@ -78,7 +78,7 @@ impl FlowList { /// /// O(1) pub fn push_back(&mut self, new_tail: FlowRef) { - self.flows.push_back(new_tail); + self.flows.push(new_tail); } /// Create an empty list @@ -99,9 +99,9 @@ impl FlowList { /// Provide a forward iterator with mutable references #[inline] - pub fn mut_iter<'a>(&'a mut self) -> MutFlowListIterator<'a> { + pub fn iter_mut<'a>(&'a mut self) -> MutFlowListIterator<'a> { MutFlowListIterator { - it: self.flows.mut_iter(), + it: self.flows.iter_mut(), } } } diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs index 61c7bb2a61b..c695c038c8a 100644 --- a/components/layout/fragment.rs +++ b/components/layout/fragment.rs @@ -467,7 +467,7 @@ impl Fragment { if self.inline_context.is_none() { self.inline_context = Some(InlineFragmentContext::new()); } - self.inline_context.get_mut_ref().styles.push(style.clone()); + self.inline_context.as_mut().unwrap().styles.push(style.clone()); } /// Uses the style only to estimate the intrinsic inline-sizes. These may be modified for text or diff --git a/components/layout/inline.rs b/components/layout/inline.rs index ae47937a037..bdae0326323 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -495,7 +495,7 @@ impl LineBreaker { inline_start.new_line_pos = vec![]; self.push_fragment_to_line(inline_start); - for inline_end in inline_end.move_iter() { + for inline_end in inline_end.into_iter() { debug!("LineBreaker: Deferring the fragment to the inline_end of the new-line \ character to the line."); let mut inline_end = split_fragment(inline_end); @@ -680,7 +680,7 @@ impl InlineFragments { // FIXME (rust#16151): This can be reverted back to using skip_while once // the upstream bug is fixed. - let mut fragments = mem::replace(&mut self.fragments, vec![]).move_iter(); + let mut fragments = mem::replace(&mut self.fragments, vec![]).into_iter(); let mut new_fragments = Vec::new(); let mut skipping = true; for fragment in fragments { @@ -703,7 +703,7 @@ impl InlineFragments { } let mut new_fragments = self.fragments.clone(); - while new_fragments.len() > 0 && new_fragments.as_slice().last().get_ref().is_whitespace_only() { + while new_fragments.len() > 0 && new_fragments.as_slice().last().as_ref().unwrap().is_whitespace_only() { debug!("stripping ignorable whitespace from end"); drop(new_fragments.pop()); } @@ -757,7 +757,7 @@ impl InlineFlow { // not recurse on a line if nothing in it can intersect the dirty region. debug!("Flow: building display list for {:u} inline fragments", self.fragments.len()); - for fragment in self.fragments.fragments.mut_iter() { + for fragment in self.fragments.fragments.iter_mut() { let rel_offset = fragment.relative_position(&self.base .absolute_position_info .relative_containing_block_size); @@ -923,7 +923,7 @@ impl Flow for InlineFlow { } let mut intrinsic_inline_sizes = IntrinsicISizes::new(); - for fragment in self.fragments.fragments.mut_iter() { + for fragment in self.fragments.fragments.iter_mut() { debug!("Flow: measuring {}", *fragment); let fragment_intrinsic_inline_sizes = @@ -953,7 +953,7 @@ impl Flow for InlineFlow { { let inline_size = self.base.position.size.inline; let this = &mut *self; - for fragment in this.fragments.fragments.mut_iter() { + for fragment in this.fragments.fragments.iter_mut() { fragment.assign_replaced_inline_size_if_necessary(inline_size); } } @@ -982,7 +982,7 @@ impl Flow for InlineFlow { debug!("assign_block_size_inline: floats in: {:?}", self.base.floats); // assign block-size for inline fragments - for fragment in self.fragments.fragments.mut_iter() { + for fragment in self.fragments.fragments.iter_mut() { fragment.assign_replaced_block_size_if_necessary(); } @@ -995,7 +995,7 @@ impl Flow for InlineFlow { // Now, go through each line and lay out the fragments inside. let mut line_distance_from_flow_block_start = Au(0); - for line in self.lines.mut_iter() { + for line in self.lines.iter_mut() { // Lay out fragments horizontally. InlineFlow::set_horizontal_fragment_positions(&mut self.fragments, line, text_align); @@ -1124,7 +1124,7 @@ impl Flow for InlineFlow { } fn compute_absolute_position(&mut self) { - for f in self.fragments.fragments.mut_iter() { + for f in self.fragments.fragments.iter_mut() { match f.specific { InlineBlockFragment(ref mut info) => { let block_flow = info.flow_ref.get_mut().as_block(); diff --git a/components/layout/layout_debug.rs b/components/layout/layout_debug.rs index 58db599c9e2..1c998e2bc4a 100644 --- a/components/layout/layout_debug.rs +++ b/components/layout/layout_debug.rs @@ -81,7 +81,7 @@ impl Drop for Scope { let mut state = refcell.borrow_mut(); let mut current_scope = state.scope_stack.pop().unwrap(); current_scope.post = json::encode(&state.flow_root.get()); - let previous_scope = state.scope_stack.mut_last().unwrap(); + let previous_scope = state.scope_stack.last_mut().unwrap(); previous_scope.children.push(current_scope); } None => {} diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs index d535e1c247a..e974b1287fc 100644 --- a/components/layout/layout_task.rs +++ b/components/layout/layout_task.rs @@ -909,7 +909,7 @@ impl LayoutTask { let mut layers = SmallVec1::new(); layers.push(render_layer); for layer in mem::replace(&mut flow::mut_base(layout_root.get_mut()).layers, - DList::new()).move_iter() { + DList::new()).into_iter() { layers.push(layer) } diff --git a/components/layout/table.rs b/components/layout/table.rs index 744e031fdfa..e3f9ae3667a 100644 --- a/components/layout/table.rs +++ b/components/layout/table.rs @@ -107,7 +107,7 @@ impl TableFlow { pub fn update_col_inline_sizes(self_inline_sizes: &mut Vec<Au>, kid_inline_sizes: &Vec<Au>) -> Au { let mut sum_inline_sizes = Au(0); let mut kid_inline_sizes_it = kid_inline_sizes.iter(); - for self_inline_size in self_inline_sizes.mut_iter() { + for self_inline_size in self_inline_sizes.iter_mut() { match kid_inline_sizes_it.next() { Some(kid_inline_size) => { if *self_inline_size < *kid_inline_size { @@ -197,7 +197,7 @@ impl Flow for TableFlow { if !did_first_row { did_first_row = true; let mut child_inline_sizes = kid_col_inline_sizes.iter(); - for col_inline_size in self.col_inline_sizes.mut_iter() { + for col_inline_size in self.col_inline_sizes.iter_mut() { match child_inline_sizes.next() { Some(child_inline_size) => { if *col_inline_size == Au::new(0) { @@ -280,12 +280,12 @@ impl Flow for TableFlow { // any, or among all the columns if all are specified. if (total_column_inline_size < content_inline_size) && (num_unspecified_inline_sizes == 0) { let ratio = content_inline_size.to_f64().unwrap() / total_column_inline_size.to_f64().unwrap(); - for col_inline_size in self.col_inline_sizes.mut_iter() { + for col_inline_size in self.col_inline_sizes.iter_mut() { *col_inline_size = (*col_inline_size).scale_by(ratio); } } else if num_unspecified_inline_sizes != 0 { let extra_column_inline_size = (content_inline_size - total_column_inline_size) / num_unspecified_inline_sizes; - for col_inline_size in self.col_inline_sizes.mut_iter() { + for col_inline_size in self.col_inline_sizes.iter_mut() { if *col_inline_size == Au(0) { *col_inline_size = extra_column_inline_size; } diff --git a/components/layout/text.rs b/components/layout/text.rs index e90272e218a..e2ab1d545d5 100644 --- a/components/layout/text.rs +++ b/components/layout/text.rs @@ -231,7 +231,7 @@ impl TextRunScanner { continue } - let new_text_fragment_info = ScannedTextFragmentInfo::new(run.get_ref().clone(), range); + let new_text_fragment_info = ScannedTextFragmentInfo::new(run.as_ref().unwrap().clone(), range); let old_fragment = &in_fragments[i.to_uint()]; let new_metrics = new_text_fragment_info.run.metrics_for_range(&range); let bounding_box_size = bounding_box_for_run_metrics( diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs index 36bebcaf760..eb1eedfeaa2 100644 --- a/components/layout/wrapper.rs +++ b/components/layout/wrapper.rs @@ -452,7 +452,7 @@ impl<'le> TElement for LayoutElement<'le> { fn get_content(content_list: &content::T) -> String { match *content_list { content::Content(ref value) => { - let iter = &mut value.clone().move_iter().peekable(); + let iter = &mut value.clone().into_iter().peekable(); match iter.next() { Some(content::StringContent(content)) => content, _ => "".to_string(), @@ -533,13 +533,13 @@ impl<'ln> TLayoutNode for ThreadSafeLayoutNode<'ln> { fn text(&self) -> String { if self.pseudo != Normal { let layout_data_ref = self.borrow_layout_data(); - let node_layout_data_wrapper = layout_data_ref.get_ref(); + let node_layout_data_wrapper = layout_data_ref.as_ref().unwrap(); if self.pseudo == Before || self.pseudo == BeforeBlock { - let before_style = node_layout_data_wrapper.data.before_style.get_ref(); + let before_style = node_layout_data_wrapper.data.before_style.as_ref().unwrap(); return get_content(&before_style.get_box().content) } else { - let after_style = node_layout_data_wrapper.data.after_style.get_ref(); + let after_style = node_layout_data_wrapper.data.after_style.as_ref().unwrap(); return get_content(&after_style.get_box().content) } } @@ -610,19 +610,19 @@ impl<'ln> ThreadSafeLayoutNode<'ln> { pub fn is_block(&self, kind: PseudoElementType) -> bool { let mut layout_data_ref = self.mutate_layout_data(); - let node_layout_data_wrapper = layout_data_ref.get_mut_ref(); + let node_layout_data_wrapper = layout_data_ref.as_mut().unwrap(); let display = match kind { Before | BeforeBlock => { - let before_style = node_layout_data_wrapper.data.before_style.get_ref(); + let before_style = node_layout_data_wrapper.data.before_style.as_ref().unwrap(); before_style.get_box().display } After | AfterBlock => { - let after_style = node_layout_data_wrapper.data.after_style.get_ref(); + let after_style = node_layout_data_wrapper.data.after_style.as_ref().unwrap(); after_style.get_box().display } Normal => { - let after_style = node_layout_data_wrapper.shared_data.style.get_ref(); + let after_style = node_layout_data_wrapper.shared_data.style.as_ref().unwrap(); after_style.get_box().display } }; @@ -632,13 +632,13 @@ impl<'ln> ThreadSafeLayoutNode<'ln> { pub fn has_before_pseudo(&self) -> bool { let layout_data_wrapper = self.borrow_layout_data(); - let layout_data_wrapper_ref = layout_data_wrapper.get_ref(); + let layout_data_wrapper_ref = layout_data_wrapper.as_ref().unwrap(); layout_data_wrapper_ref.data.before_style.is_some() } pub fn has_after_pseudo(&self) -> bool { let layout_data_wrapper = self.borrow_layout_data(); - let layout_data_wrapper_ref = layout_data_wrapper.get_ref(); + let layout_data_wrapper_ref = layout_data_wrapper.as_ref().unwrap(); layout_data_wrapper_ref.data.after_style.is_some() } diff --git a/components/net/data_loader.rs b/components/net/data_loader.rs index 2a74cad2a1b..8044da5ec1e 100644 --- a/components/net/data_loader.rs +++ b/components/net/data_loader.rs @@ -63,7 +63,7 @@ fn load(load_data: LoadData, start_chan: Sender<LoadResponse>) { if is_base64 { // FIXME(#2909): It’s unclear what to do with non-alphabet characters, // but Acid 3 apparently depends on spaces being ignored. - let bytes = bytes.move_iter().filter(|&b| b != ' ' as u8).collect::<Vec<u8>>(); + let bytes = bytes.into_iter().filter(|&b| b != ' ' as u8).collect::<Vec<u8>>(); match bytes.as_slice().from_base64() { Err(..) => { progress_chan.send(Done(Err("non-base64 data uri".to_string()))); diff --git a/components/net/fetch/cors_cache.rs b/components/net/fetch/cors_cache.rs index b98874af790..d7021cd7a6b 100644 --- a/components/net/fetch/cors_cache.rs +++ b/components/net/fetch/cors_cache.rs @@ -108,7 +108,7 @@ impl BasicCORSCache { fn find_entry_by_header<'a>(&'a mut self, request: &CacheRequestDetails, header_name: &str) -> Option<&'a mut CORSCacheEntry> { self.cleanup(); let BasicCORSCache(ref mut buf) = *self; - let entry = buf.mut_iter().find(|e| e.origin.scheme == request.origin.scheme && + let entry = buf.iter_mut().find(|e| e.origin.scheme == request.origin.scheme && e.origin.host() == request.origin.host() && e.origin.port() == request.origin.port() && e.url == request.destination && @@ -121,7 +121,7 @@ impl BasicCORSCache { // we can take the method from CORSRequest itself self.cleanup(); let BasicCORSCache(ref mut buf) = *self; - let entry = buf.mut_iter().find(|e| e.origin.scheme == request.origin.scheme && + let entry = buf.iter_mut().find(|e| e.origin.scheme == request.origin.scheme && e.origin.host() == request.origin.host() && e.origin.port() == request.origin.port() && e.url == request.destination && @@ -136,7 +136,7 @@ impl CORSCache for BasicCORSCache { #[allow(dead_code)] fn clear (&mut self, request: CacheRequestDetails) { let BasicCORSCache(buf) = self.clone(); - let new_buf: Vec<CORSCacheEntry> = buf.move_iter().filter(|e| e.origin == request.origin && request.destination == e.url).collect(); + let new_buf: Vec<CORSCacheEntry> = buf.into_iter().filter(|e| e.origin == request.origin && request.destination == e.url).collect(); *self = BasicCORSCache(new_buf); } @@ -144,7 +144,7 @@ impl CORSCache for BasicCORSCache { fn cleanup(&mut self) { let BasicCORSCache(buf) = self.clone(); let now = time::now().to_timespec(); - let new_buf: Vec<CORSCacheEntry> = buf.move_iter().filter(|e| now.sec > e.created.sec + e.max_age as i64).collect(); + let new_buf: Vec<CORSCacheEntry> = buf.into_iter().filter(|e| now.sec > e.created.sec + e.max_age as i64).collect(); *self = BasicCORSCache(new_buf); } diff --git a/components/net/image_cache_task.rs b/components/net/image_cache_task.rs index 16d1a54fe99..cf0cb9a0bd2 100644 --- a/components/net/image_cache_task.rs +++ b/components/net/image_cache_task.rs @@ -464,7 +464,7 @@ fn load_image_data(url: Url, resource_task: ResourceTask) -> Result<Vec<u8>, ()> image_data.push_all(data.as_slice()); } resource_task::Done(result::Ok(..)) => { - return Ok(image_data.move_iter().collect()); + return Ok(image_data.into_iter().collect()); } resource_task::Done(result::Err(..)) => { return Err(()); diff --git a/components/script/cors.rs b/components/script/cors.rs index 33c614b661d..a4702eb21de 100644 --- a/components/script/cors.rs +++ b/components/script/cors.rs @@ -315,7 +315,7 @@ impl CORSCache { #[allow(dead_code)] fn clear (&mut self, request: &CORSRequest) { let CORSCache(buf) = self.clone(); - let new_buf: Vec<CORSCacheEntry> = buf.move_iter().filter(|e| e.origin == request.origin && request.destination == e.url).collect(); + let new_buf: Vec<CORSCacheEntry> = buf.into_iter().filter(|e| e.origin == request.origin && request.destination == e.url).collect(); *self = CORSCache(new_buf); } @@ -323,7 +323,7 @@ impl CORSCache { fn cleanup(&mut self) { let CORSCache(buf) = self.clone(); let now = time::now().to_timespec(); - let new_buf: Vec<CORSCacheEntry> = buf.move_iter().filter(|e| now.sec > e.created.sec + e.max_age as i64).collect(); + let new_buf: Vec<CORSCacheEntry> = buf.into_iter().filter(|e| now.sec > e.created.sec + e.max_age as i64).collect(); *self = CORSCache(new_buf); } @@ -332,7 +332,7 @@ impl CORSCache { self.cleanup(); let CORSCache(ref mut buf) = *self; // Credentials are not yet implemented here - let entry = buf.mut_iter().find(|e| e.origin.scheme == request.origin.scheme && + let entry = buf.iter_mut().find(|e| e.origin.scheme == request.origin.scheme && e.origin.host() == request.origin.host() && e.origin.port() == request.origin.port() && e.url == request.destination && @@ -353,7 +353,7 @@ impl CORSCache { self.cleanup(); let CORSCache(ref mut buf) = *self; // Credentials are not yet implemented here - let entry = buf.mut_iter().find(|e| e.origin.scheme == request.origin.scheme && + let entry = buf.iter_mut().find(|e| e.origin.scheme == request.origin.scheme && e.origin.host() == request.origin.host() && e.origin.port() == request.origin.port() && e.url == request.destination && diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index 42a9a09d7fc..383595248c3 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -1798,7 +1798,7 @@ let obj = with_compartment(aCx, proto, || { NewProxyObject(aCx, handler, &private, proto, %s, - ptr::mut_null(), ptr::mut_null()) + ptr::null_mut(), ptr::null_mut()) }); assert!(obj.is_not_null()); @@ -3666,7 +3666,7 @@ if expando.is_not_null() { } } """ + namedGet + """ -(*desc).obj = ptr::mut_null(); +(*desc).obj = ptr::null_mut(); return true;""" def definition_body(self): @@ -4303,11 +4303,11 @@ class CGDictionary(CGThing): return string.Template( "impl<'a, 'b> ${selfName}<'a, 'b> {\n" " pub fn empty() -> ${selfName}<'a, 'b> {\n" - " ${selfName}::new(ptr::mut_null(), NullValue()).unwrap()\n" + " ${selfName}::new(ptr::null_mut(), NullValue()).unwrap()\n" " }\n" " pub fn new(cx: *mut JSContext, val: JSVal) -> Result<${selfName}<'a, 'b>, ()> {\n" " let object = if val.is_null_or_undefined() {\n" - " ptr::mut_null()\n" + " ptr::null_mut()\n" " } else if val.is_object() {\n" " val.to_object()\n" " } else {\n" @@ -4914,7 +4914,7 @@ class CGCallback(CGClass): # the private method. argnames = [arg.name for arg in args] argnamesWithThis = ["s.GetContext()", "thisObjJS"] + argnames - argnamesWithoutThis = ["s.GetContext()", "ptr::mut_null()"] + argnames + argnamesWithoutThis = ["s.GetContext()", "ptr::null_mut()"] + argnames # Now that we've recorded the argnames for our call to our private # method, insert our optional argument for deciding whether the # CallSetup should re-throw exceptions on aRv. diff --git a/components/script/dom/bindings/utils.rs b/components/script/dom/bindings/utils.rs index 1b69970b582..a923371ae8e 100644 --- a/components/script/dom/bindings/utils.rs +++ b/components/script/dom/bindings/utils.rs @@ -660,7 +660,7 @@ pub extern fn outerize_global(_cx: *mut JSContext, obj: JSHandleObject) -> *mut IDLInterface::get_prototype_depth(None::<window::Window>)) .unwrap() .root(); - win.deref().browser_context.deref().borrow().get_ref().window_proxy() + win.deref().browser_context.deref().borrow().as_ref().unwrap().window_proxy() } } diff --git a/components/script/dom/browsercontext.rs b/components/script/dom/browsercontext.rs index 435b618c153..c9ac5e2f040 100644 --- a/components/script/dom/browsercontext.rs +++ b/components/script/dom/browsercontext.rs @@ -53,11 +53,11 @@ impl BrowserContext { let page = win.deref().page(); let js_info = page.js_info(); - let handler = js_info.get_ref().dom_static.windowproxy_handler; + let handler = js_info.as_ref().unwrap().dom_static.windowproxy_handler; assert!(handler.deref().is_not_null()); let parent = win.deref().reflector().get_jsobject(); - let cx = js_info.get_ref().js_context.deref().deref().ptr; + let cx = js_info.as_ref().unwrap().js_context.deref().deref().ptr; let wrapper = with_compartment(cx, parent, || unsafe { WrapperNew(cx, parent, *handler.deref()) }); diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index b6971f5dd14..265131f00f0 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -356,12 +356,14 @@ impl<'a> PrivateDocumentHelpers for JSRef<'a, Document> { } fn get_html_element(self) -> Option<Temporary<HTMLHtmlElement>> { - self.GetDocumentElement().root().filtered(|root| { - let root: JSRef<Node> = NodeCast::from_ref(**root); - root.type_id() == ElementNodeTypeId(HTMLHtmlElementTypeId) - }).map(|elem| { - Temporary::from_rooted(HTMLHtmlElementCast::to_ref(*elem).unwrap()) - }) + match self.GetDocumentElement().root() { + Some(ref root) if { + let root: JSRef<Node> = NodeCast::from_ref(**root); + root.type_id() == ElementNodeTypeId(HTMLHtmlElementTypeId) + } => Some(Temporary::from_rooted(HTMLHtmlElementCast::to_ref(**root).unwrap())), + + _ => None, + } } } @@ -371,7 +373,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> { if self.implementation.get().is_none() { self.implementation.assign(Some(DOMImplementation::new(self))); } - Temporary::new(self.implementation.get().get_ref().clone()) + Temporary::new(self.implementation.get().as_ref().unwrap().clone()) } // http://dom.spec.whatwg.org/#dom-document-url @@ -751,7 +753,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> { let filter = box ImagesFilter; self.images.assign(Some(HTMLCollection::create(*window, root, filter))); } - Temporary::new(self.images.get().get_ref().clone()) + Temporary::new(self.images.get().as_ref().unwrap().clone()) } fn Embeds(self) -> Temporary<HTMLCollection> { @@ -761,7 +763,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> { let filter = box EmbedsFilter; self.embeds.assign(Some(HTMLCollection::create(*window, root, filter))); } - Temporary::new(self.embeds.get().get_ref().clone()) + Temporary::new(self.embeds.get().as_ref().unwrap().clone()) } fn Plugins(self) -> Temporary<HTMLCollection> { @@ -775,7 +777,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> { let filter = box LinksFilter; self.links.assign(Some(HTMLCollection::create(*window, root, filter))); } - Temporary::new(self.links.get().get_ref().clone()) + Temporary::new(self.links.get().as_ref().unwrap().clone()) } fn Forms(self) -> Temporary<HTMLCollection> { @@ -785,7 +787,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> { let filter = box FormsFilter; self.forms.assign(Some(HTMLCollection::create(*window, root, filter))); } - Temporary::new(self.forms.get().get_ref().clone()) + Temporary::new(self.forms.get().as_ref().unwrap().clone()) } fn Scripts(self) -> Temporary<HTMLCollection> { @@ -795,7 +797,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> { let filter = box ScriptsFilter; self.scripts.assign(Some(HTMLCollection::create(*window, root, filter))); } - Temporary::new(self.scripts.get().get_ref().clone()) + Temporary::new(self.scripts.get().as_ref().unwrap().clone()) } fn Anchors(self) -> Temporary<HTMLCollection> { @@ -805,7 +807,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> { let filter = box AnchorsFilter; self.anchors.assign(Some(HTMLCollection::create(*window, root, filter))); } - Temporary::new(self.anchors.get().get_ref().clone()) + Temporary::new(self.anchors.get().as_ref().unwrap().clone()) } fn Applets(self) -> Temporary<HTMLCollection> { @@ -816,7 +818,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> { let filter = box AppletsFilter; self.applets.assign(Some(HTMLCollection::create(*window, root, filter))); } - Temporary::new(self.applets.get().get_ref().clone()) + Temporary::new(self.applets.get().as_ref().unwrap().clone()) } fn Location(self) -> Temporary<Location> { diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index 21c0127fde1..ee0abd3a3ac 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -581,7 +581,7 @@ impl<'a> ElementMethods for JSRef<'a, Element> { let window = doc.deref().window.root(); let list = NamedNodeMap::new(*window, self); self.attr_list.assign(Some(list)); - Temporary::new(self.attr_list.get().get_ref().clone()) + Temporary::new(self.attr_list.get().as_ref().unwrap().clone()) } // http://dom.spec.whatwg.org/#dom-element-getattribute diff --git a/components/script/dom/eventtarget.rs b/components/script/dom/eventtarget.rs index 823304d6d8a..62404fe4004 100644 --- a/components/script/dom/eventtarget.rs +++ b/components/script/dom/eventtarget.rs @@ -254,7 +254,7 @@ impl<'a> EventTargetMethods for JSRef<'a, EventTarget> { Some(listener) => { let mut handlers = self.handlers.deref().borrow_mut(); let mut entry = handlers.find_mut(&ty); - for entry in entry.mut_iter() { + for entry in entry.iter_mut() { let phase = if capture { Capturing } else { Bubbling }; let old_entry = EventListenerEntry { phase: phase, diff --git a/components/script/dom/formdata.rs b/components/script/dom/formdata.rs index 4374a55067e..4a023505244 100644 --- a/components/script/dom/formdata.rs +++ b/components/script/dom/formdata.rs @@ -73,7 +73,7 @@ impl<'a> FormDataMethods for JSRef<'a, FormData> { fn Get(self, name: DOMString) -> Option<FileOrString> { if self.data.deref().borrow().contains_key_equiv(&name) { - match self.data.deref().borrow().get(&name)[0].clone() { + match (*self.data.deref().borrow())[name][0].clone() { StringData(ref s) => Some(eString(s.clone())), FileData(ref f) => { Some(eFile(f.clone())) diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index bcd613c753b..40b3aa57085 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -657,7 +657,7 @@ impl<'m, 'n> NodeHelpers<'m, 'n> for JSRef<'n, Node> { } fn owner_doc(&self) -> Temporary<Document> { - Temporary::new(self.owner_doc.get().get_ref().clone()) + Temporary::new(self.owner_doc.get().as_ref().unwrap().clone()) } fn set_owner_doc(&self, document: JSRef<Document>) { @@ -869,7 +869,7 @@ impl<'a> Iterator<JSRef<'a, Node>> for AncestorIterator<'a> { } // FIXME: Do we need two clones here? - let x = self.current.get_ref().clone(); + let x = self.current.as_ref().unwrap().clone(); self.current = x.parent_node().map(|node| (*node.root()).clone()); Some(x) } @@ -1236,7 +1236,7 @@ impl Node { // Step 7: mutation records. // Step 8. - for node in nodes.mut_iter() { + for node in nodes.iter_mut() { parent.add_child(*node, child); let is_in_doc = parent.is_in_doc(); for kid in node.traverse_preorder() { @@ -1571,7 +1571,7 @@ impl<'a> NodeMethods for JSRef<'a, Node> { let window = doc.deref().window.root(); let child_list = NodeList::new_child_list(*window, self); self.child_list.assign(Some(child_list)); - Temporary::new(self.child_list.get().get_ref().clone()) + Temporary::new(self.child_list.get().as_ref().unwrap().clone()) } // http://dom.spec.whatwg.org/#dom-node-firstchild diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index 50d78ad8208..371e33d4588 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -98,7 +98,7 @@ pub struct Window { impl Window { pub fn get_cx(&self) -> *mut JSContext { let js_info = self.page().js_info(); - (**js_info.get_ref().js_context).ptr + (**js_info.as_ref().unwrap().js_context).ptr } pub fn page<'a>(&'a self) -> &'a Page { @@ -112,7 +112,7 @@ impl Window { #[unsafe_destructor] impl Drop for Window { fn drop(&mut self) { - for (_, timer_handle) in self.active_timers.borrow_mut().mut_iter() { + for (_, timer_handle) in self.active_timers.borrow_mut().iter_mut() { timer_handle.cancel(); } } @@ -215,7 +215,7 @@ impl<'a> WindowMethods for JSRef<'a, Window> { fn Document(self) -> Temporary<Document> { let frame = self.page().frame(); - Temporary::new(frame.get_ref().document.clone()) + Temporary::new(frame.as_ref().unwrap().document.clone()) } fn Location(self) -> Temporary<Location> { @@ -224,7 +224,7 @@ impl<'a> WindowMethods for JSRef<'a, Window> { let location = Location::new(self, page); self.location.assign(Some(location)); } - Temporary::new(self.location.get().get_ref().clone()) + Temporary::new(self.location.get().as_ref().unwrap().clone()) } fn Console(self) -> Temporary<Console> { @@ -232,7 +232,7 @@ impl<'a> WindowMethods for JSRef<'a, Window> { let console = Console::new(&global::Window(self)); self.console.assign(Some(console)); } - Temporary::new(self.console.get().get_ref().clone()) + Temporary::new(self.console.get().as_ref().unwrap().clone()) } fn Navigator(self) -> Temporary<Navigator> { @@ -240,7 +240,7 @@ impl<'a> WindowMethods for JSRef<'a, Window> { let navigator = Navigator::new(self); self.navigator.assign(Some(navigator)); } - Temporary::new(self.navigator.get().get_ref().clone()) + Temporary::new(self.navigator.get().as_ref().unwrap().clone()) } fn SetTimeout(self, _cx: *mut JSContext, callback: JSVal, timeout: i32) -> i32 { @@ -288,7 +288,7 @@ impl<'a> WindowMethods for JSRef<'a, Window> { let performance = Performance::new(self); self.performance.assign(Some(performance)); } - Temporary::new(self.performance.get().get_ref().clone()) + Temporary::new(self.performance.get().as_ref().unwrap().clone()) } fn GetOnclick(self) -> Option<EventHandlerNonNull> { @@ -336,7 +336,7 @@ impl<'a> WindowMethods for JSRef<'a, Window> { let screen = Screen::new(self); self.screen.assign(Some(screen)); } - Temporary::new(self.screen.get().get_ref().clone()) + Temporary::new(self.screen.get().as_ref().unwrap().clone()) } fn Debug(self, message: DOMString) { diff --git a/components/script/dom/workerglobalscope.rs b/components/script/dom/workerglobalscope.rs index b0df64f0b11..f5bb583fddb 100644 --- a/components/script/dom/workerglobalscope.rs +++ b/components/script/dom/workerglobalscope.rs @@ -88,12 +88,12 @@ impl<'a> WorkerGlobalScopeMethods for JSRef<'a, WorkerGlobalScope> { let location = WorkerLocation::new(self, self.worker_url.deref().clone()); self.location.assign(Some(location)); } - Temporary::new(self.location.get().get_ref().clone()) + Temporary::new(self.location.get().as_ref().unwrap().clone()) } fn ImportScripts(self, url_strings: Vec<DOMString>) -> ErrorResult { let mut urls = Vec::with_capacity(url_strings.len()); - for url in url_strings.move_iter() { + for url in url_strings.into_iter() { let url = UrlParser::new().base_url(&*self.worker_url) .parse(url.as_slice()); match url { @@ -102,7 +102,7 @@ impl<'a> WorkerGlobalScopeMethods for JSRef<'a, WorkerGlobalScope> { }; } - for url in urls.move_iter() { + for url in urls.into_iter() { let (url, source) = match load_whole_resource(&*self.resource_task, url) { Err(_) => return Err(Network), Ok((metadata, bytes)) => { @@ -128,7 +128,7 @@ impl<'a> WorkerGlobalScopeMethods for JSRef<'a, WorkerGlobalScope> { let navigator = WorkerNavigator::new(self); self.navigator.assign(Some(navigator)); } - Temporary::new(self.navigator.get().get_ref().clone()) + Temporary::new(self.navigator.get().as_ref().unwrap().clone()) } fn Console(self) -> Temporary<Console> { @@ -136,7 +136,7 @@ impl<'a> WorkerGlobalScopeMethods for JSRef<'a, WorkerGlobalScope> { let console = Console::new(&global::Worker(self)); self.console.assign(Some(console)); } - Temporary::new(self.console.get().get_ref().clone()) + Temporary::new(self.console.get().as_ref().unwrap().clone()) } fn Btoa(self, btoa: DOMString) -> Fallible<DOMString> { diff --git a/components/script/html/hubbub_html_parser.rs b/components/script/html/hubbub_html_parser.rs index 96f23174a61..097f8438cb5 100644 --- a/components/script/html/hubbub_html_parser.rs +++ b/components/script/html/hubbub_html_parser.rs @@ -519,7 +519,7 @@ pub fn parse_html(page: &Page, let load_response = load_response.unwrap(); match load_response.metadata.content_type { Some((ref t, _)) if t.as_slice().eq_ignore_ascii_case("image") => { - let page = format!("<html><body><img src='{:s}' /></body></html>", base_url.get_ref().serialize()); + let page = format!("<html><body><img src='{:s}' /></body></html>", base_url.as_ref().unwrap().serialize()); parser.parse_chunk(page.into_bytes().as_slice()); }, _ => loop { diff --git a/components/script/lib.rs b/components/script/lib.rs index 8b84332bcb9..c4b6b675d42 100644 --- a/components/script/lib.rs +++ b/components/script/lib.rs @@ -8,7 +8,7 @@ #![feature(globs, macro_rules, struct_variant, phase, unsafe_destructor)] #![deny(unused_imports, unused_variable)] -#![allow(non_snake_case_functions)] +#![allow(non_snake_case)] #![doc="The script crate contains all matters DOM."] diff --git a/components/script/page.rs b/components/script/page.rs index c612ba6a791..a9469609576 100644 --- a/components/script/page.rs +++ b/components/script/page.rs @@ -169,7 +169,7 @@ impl Page { let damaged = self.damage.borrow().is_some(); if damaged { let frame = self.frame(); - let window = frame.get_ref().window.root(); + let window = frame.as_ref().unwrap().window.root(); self.reflow(goal, window.control_chan.clone(), &**window.compositor); } else { self.avoided_reflows.set(self.avoided_reflows.get() + 1); @@ -192,7 +192,7 @@ impl Page { self.children .deref() .borrow_mut() - .mut_iter() + .iter_mut() .enumerate() .find(|&(_idx, ref page_tree)| { // FIXME: page_tree has a lifetime such that it's unusable for anything. @@ -204,7 +204,7 @@ impl Page { match remove_idx { Some(idx) => return Some(self.children.deref().borrow_mut().remove(idx).unwrap()), None => { - for page_tree in self.children.deref().borrow_mut().mut_iter() { + for page_tree in self.children.deref().borrow_mut().iter_mut() { match page_tree.remove(id) { found @ Some(_) => return found, None => (), // keep going... @@ -292,7 +292,7 @@ impl Page { } pub fn get_url(&self) -> Url { - self.url().get_ref().ref0().clone() + self.url().as_ref().unwrap().ref0().clone() } // FIXME(cgaebel): join_layout is racey. What if the compositor triggers a @@ -393,7 +393,7 @@ impl Page { /// Attempt to find a named element in this page's document. pub fn find_fragment_node(&self, fragid: DOMString) -> Option<Temporary<Element>> { - let document = self.frame().get_ref().document.root(); + let document = self.frame().as_ref().unwrap().document.root(); match document.deref().GetElementById(fragid.to_string()) { Some(node) => Some(node), None => { @@ -412,7 +412,7 @@ impl Page { pub fn hit_test(&self, point: &Point2D<f32>) -> Option<UntrustedNodeAddress> { let frame = self.frame(); - let document = frame.get_ref().document.root(); + let document = frame.as_ref().unwrap().document.root(); let root = document.deref().GetDocumentElement().root(); if root.is_none() { return None; @@ -433,7 +433,7 @@ impl Page { pub fn get_nodes_under_mouse(&self, point: &Point2D<f32>) -> Option<Vec<UntrustedNodeAddress>> { let frame = self.frame(); - let document = frame.get_ref().document.root(); + let document = frame.as_ref().unwrap().document.root(); let root = document.deref().GetDocumentElement().root(); if root.is_none() { return None; diff --git a/components/script/script_task.rs b/components/script/script_task.rs index 878d6eab5c0..9aed829a633 100644 --- a/components/script/script_task.rs +++ b/components/script/script_task.rs @@ -376,7 +376,7 @@ impl ScriptTask { } pub fn get_cx(&self) -> *mut JSContext { - (**self.js_context.borrow().get_ref()).ptr + (**self.js_context.borrow().as_ref().unwrap()).ptr } /// Starts the script task. After calling this method, the script task will loop receiving @@ -412,7 +412,7 @@ impl ScriptTask { } } - for (id, size) in resizes.move_iter() { + for (id, size) in resizes.into_iter() { self.handle_event(id, ResizeEvent(size)); } @@ -485,7 +485,7 @@ impl ScriptTask { } // Process the gathered events. - for msg in sequential.move_iter() { + for msg in sequential.into_iter() { match msg { // TODO(tkuehn) need to handle auxiliary layouts for iframes FromConstellation(AttachLayoutMsg(_)) => fail!("should have handled AttachLayoutMsg already"), @@ -605,7 +605,7 @@ impl ScriptTask { window_size, parent_page.resource_task.deref().clone(), self.constellation_chan.clone(), - self.js_context.borrow().get_ref().clone()) + self.js_context.borrow().as_ref().unwrap().clone()) }; parent_page.children.deref().borrow_mut().push(Rc::new(new_page)); } @@ -616,7 +616,7 @@ impl ScriptTask { let page = page.find(id).expect("ScriptTask: received fire timer msg for a pipeline ID not associated with this script task. This is a bug."); let frame = page.frame(); - let window = frame.get_ref().window.root(); + let window = frame.as_ref().unwrap().window.root(); window.handle_fire_timer(timer_id, self.get_cx()); } @@ -729,7 +729,7 @@ impl ScriptTask { let last_url = last_loaded_url.map(|(ref loaded, _)| loaded.clone()); let cx = self.js_context.borrow(); - let cx = cx.get_ref(); + let cx = cx.as_ref().unwrap(); // Create the window and document objects. let window = Window::new(cx.deref().ptr, page.clone(), @@ -742,7 +742,7 @@ impl ScriptTask { Some(url) => Some(url.clone()), None => Url::parse("about:blank").ok(), }; - *page.mut_url() = Some((doc_url.get_ref().clone(), true)); + *page.mut_url() = Some((doc_url.as_ref().unwrap().clone(), true)); doc_url } else { Some(url.clone()) @@ -974,7 +974,7 @@ impl ScriptTask { let mouse_over_targets = &mut *self.mouse_over_targets.borrow_mut(); match *mouse_over_targets { Some(ref mut mouse_over_targets) => { - for node in mouse_over_targets.mut_iter() { + for node in mouse_over_targets.iter_mut() { let node = node.root(); node.deref().set_hover_state(false); } diff --git a/components/style/font_face.rs b/components/style/font_face.rs index 81e1dadf0a8..9e8a6b689ac 100644 --- a/components/style/font_face.rs +++ b/components/style/font_face.rs @@ -70,7 +70,7 @@ pub fn parse_font_face_rule(rule: AtRule, parent_rules: &mut Vec<CSSRule>, base_ let mut maybe_family = None; let mut maybe_sources = None; - for item in ErrorLoggerIterator(parse_declaration_list(block.move_iter())) { + for item in ErrorLoggerIterator(parse_declaration_list(block.into_iter())) { match item { DeclAtRule(rule) => log_css_error( rule.location, format!("Unsupported at-rule in declaration list: @{:s}", rule.name).as_slice()), diff --git a/components/style/media_queries.rs b/components/style/media_queries.rs index 2c7b6b4b08f..8e0df248f2d 100644 --- a/components/style/media_queries.rs +++ b/components/style/media_queries.rs @@ -59,7 +59,7 @@ pub fn parse_media_rule(rule: AtRule, parent_rules: &mut Vec<CSSRule>, } }; let mut rules = vec!(); - for rule in ErrorLoggerIterator(parse_rule_list(block.move_iter())) { + for rule in ErrorLoggerIterator(parse_rule_list(block.into_iter())) { match rule { QualifiedRule(rule) => parse_style_rule(rule, &mut rules, namespaces, base_url), AtRule(rule) => parse_nested_at_rule( @@ -94,13 +94,13 @@ pub fn parse_media_query_list(input: &[ComponentValue]) -> MediaQueryList { }; match iter.next() { None => { - for mq in mq.move_iter() { + for mq in mq.into_iter() { queries.push(mq); } return MediaQueryList{ media_queries: queries } }, Some(&Comma) => { - for mq in mq.move_iter() { + for mq in mq.into_iter() { queries.push(mq); } }, diff --git a/components/style/properties/common_types.rs b/components/style/properties/common_types.rs index d85e1bef879..feea1fe0efd 100644 --- a/components/style/properties/common_types.rs +++ b/components/style/properties/common_types.rs @@ -229,14 +229,14 @@ pub mod computed { // TODO, as needed: root font size, viewport size, etc. } - #[allow(non_snake_case_functions)] + #[allow(non_snake_case)] #[inline] pub fn compute_Au(value: specified::Length, context: &Context) -> Au { compute_Au_with_font_size(value, context.font_size) } /// A special version of `compute_Au` used for `font-size`. - #[allow(non_snake_case_functions)] + #[allow(non_snake_case)] #[inline] pub fn compute_Au_with_font_size(value: specified::Length, reference_font_size: Au) -> Au { match value { @@ -254,7 +254,7 @@ pub mod computed { LP_Length(Au), LP_Percentage(CSSFloat), } - #[allow(non_snake_case_functions)] + #[allow(non_snake_case)] pub fn compute_LengthOrPercentage(value: specified::LengthOrPercentage, context: &Context) -> LengthOrPercentage { match value { @@ -269,7 +269,7 @@ pub mod computed { LPA_Percentage(CSSFloat), LPA_Auto, } - #[allow(non_snake_case_functions)] + #[allow(non_snake_case)] pub fn compute_LengthOrPercentageOrAuto(value: specified::LengthOrPercentageOrAuto, context: &Context) -> LengthOrPercentageOrAuto { match value { @@ -285,7 +285,7 @@ pub mod computed { LPN_Percentage(CSSFloat), LPN_None, } - #[allow(non_snake_case_functions)] + #[allow(non_snake_case)] pub fn compute_LengthOrPercentageOrNone(value: specified::LengthOrPercentageOrNone, context: &Context) -> LengthOrPercentageOrNone { match value { diff --git a/components/style/properties/mod.rs.mako b/components/style/properties/mod.rs.mako index daed26e68c7..0befa50158c 100644 --- a/components/style/properties/mod.rs.mako +++ b/components/style/properties/mod.rs.mako @@ -1438,17 +1438,17 @@ mod property_bit_field { self.storage[bit / uint::BITS] &= !(1 << (bit % uint::BITS)) } % for i, property in enumerate(LONGHANDS): - #[allow(non_snake_case_functions)] + #[allow(non_snake_case)] #[inline] pub fn get_${property.ident}(&self) -> bool { self.get(${i}) } - #[allow(non_snake_case_functions)] + #[allow(non_snake_case)] #[inline] pub fn set_${property.ident}(&mut self) { self.set(${i}) } - #[allow(non_snake_case_functions)] + #[allow(non_snake_case)] #[inline] pub fn clear_${property.ident}(&mut self) { self.clear(${i}) @@ -1484,7 +1484,7 @@ pub fn parse_property_declaration_list<I: Iterator<Node>>(input: I, base_url: &U let mut normal_seen = PropertyBitField::new(); let items: Vec<DeclarationListItem> = ErrorLoggerIterator(parse_declaration_list(input)).collect(); - for item in items.move_iter().rev() { + for item in items.into_iter().rev() { match item { DeclAtRule(rule) => log_css_error( rule.location, format!("Unsupported at-rule in declaration list: @{:s}", rule.name).as_slice()), diff --git a/components/style/selector_matching.rs b/components/style/selector_matching.rs index a0ddf7dd31d..24abfde8840 100644 --- a/components/style/selector_matching.rs +++ b/components/style/selector_matching.rs @@ -140,7 +140,7 @@ impl SelectorMap { shareable); // Sort only the rules we just added. - sort::quicksort_by(matching_rules_list.vec_mut_slice_from(init_len), compare); + sort::quicksort_by(matching_rules_list.vec_slice_from_mut(init_len), compare); fn compare(a: &DeclarationBlock, b: &DeclarationBlock) -> Ordering { (a.specificity, a.source_order).cmp(&(b.specificity, b.source_order)) @@ -1006,7 +1006,7 @@ mod tests { let namespaces = NamespaceMap::new(); css_selectors.iter().enumerate().map(|(i, selectors)| { parse_selector_list(tokenize(*selectors).map(|(c, _)| c), &namespaces) - .unwrap().move_iter().map(|s| { + .unwrap().into_iter().map(|s| { Rule { selector: s.compound_selectors.clone(), declarations: DeclarationBlock { diff --git a/components/style/selectors.rs b/components/style/selectors.rs index c3ea921bf53..8540dc1648d 100644 --- a/components/style/selectors.rs +++ b/components/style/selectors.rs @@ -436,7 +436,7 @@ fn parse_qualified_name<I: Iterator<ComponentValue>>( fn parse_attribute_selector(content: Vec<ComponentValue>, namespaces: &NamespaceMap) -> Result<SimpleSelector, ()> { - let iter = &mut content.move_iter().peekable(); + let iter = &mut content.into_iter().peekable(); let attr = match try!(parse_qualified_name(iter, /* in_attr_selector = */ true, namespaces)) { None => return Err(()), Some((_, None)) => fail!("Implementation error, this should not happen."), @@ -537,7 +537,7 @@ fn parse_pseudo_element(name: String) -> Result<PseudoElement, ()> { /// Level 3: Parse **one** simple_selector fn parse_negation(arguments: Vec<ComponentValue>, namespaces: &NamespaceMap) -> Result<SimpleSelector, ()> { - let iter = &mut arguments.move_iter().peekable(); + let iter = &mut arguments.into_iter().peekable(); match try!(parse_type_selector(iter, namespaces)) { Some(type_selector) => Ok(Negation(type_selector)), None => { diff --git a/components/style/stylesheets.rs b/components/style/stylesheets.rs index cc2f1945ca9..c8c9f8c82df 100644 --- a/components/style/stylesheets.rs +++ b/components/style/stylesheets.rs @@ -129,10 +129,10 @@ pub fn parse_style_rule(rule: QualifiedRule, parent_rules: &mut Vec<CSSRule>, let QualifiedRule{location: location, prelude: prelude, block: block} = rule; // FIXME: avoid doing this for valid selectors let serialized = prelude.iter().to_css(); - match selectors::parse_selector_list(prelude.move_iter(), namespaces) { + match selectors::parse_selector_list(prelude.into_iter(), namespaces) { Ok(selectors) => parent_rules.push(CSSStyleRule(StyleRule{ selectors: selectors, - declarations: properties::parse_property_declaration_list(block.move_iter(), base_url) + declarations: properties::parse_property_declaration_list(block.into_iter(), base_url) })), Err(()) => log_css_error(location, format!( "Invalid/unsupported selector: {}", serialized).as_slice()), diff --git a/components/util/bloom.rs b/components/util/bloom.rs index 0019092663f..4621697fa50 100644 --- a/components/util/bloom.rs +++ b/components/util/bloom.rs @@ -262,7 +262,7 @@ impl BloomFilter { /// on every element. pub fn clear(&mut self) { self.number_of_insertions = 0; - for x in self.buf.as_mut_slice().mut_iter() { + for x in self.buf.as_mut_slice().iter_mut() { *x = 0u; } } diff --git a/components/util/cache.rs b/components/util/cache.rs index 1b159cea8c1..35d442cd079 100644 --- a/components/util/cache.rs +++ b/components/util/cache.rs @@ -238,7 +238,7 @@ impl<K:Clone+PartialEq+Hash,V:Clone> Cache<K,V> for SimpleHashCache<K,V> { } fn evict_all(&mut self) { - for slot in self.entries.mut_iter() { + for slot in self.entries.iter_mut() { *slot = None } } diff --git a/components/util/smallvec.rs b/components/util/smallvec.rs index ef47103e317..c5a9c87e84c 100644 --- a/components/util/smallvec.rs +++ b/components/util/smallvec.rs @@ -21,12 +21,12 @@ pub trait VecLike<T> { fn vec_len(&self) -> uint; fn vec_push(&mut self, value: T); - fn vec_mut_slice<'a>(&'a mut self, start: uint, end: uint) -> &'a mut [T]; + fn vec_slice_mut<'a>(&'a mut self, start: uint, end: uint) -> &'a mut [T]; #[inline] - fn vec_mut_slice_from<'a>(&'a mut self, start: uint) -> &'a mut [T] { + fn vec_slice_from_mut<'a>(&'a mut self, start: uint) -> &'a mut [T] { let len = self.vec_len(); - self.vec_mut_slice(start, len) + self.vec_slice_mut(start, len) } } @@ -42,8 +42,8 @@ impl<T> VecLike<T> for Vec<T> { } #[inline] - fn vec_mut_slice<'a>(&'a mut self, start: uint, end: uint) -> &'a mut [T] { - self.mut_slice(start, end) + fn vec_slice_mut<'a>(&'a mut self, start: uint, end: uint) -> &'a mut [T] { + self.slice_mut(start, end) } } @@ -102,7 +102,7 @@ pub trait SmallVec<T> : SmallVecPrivate<T> where T: 'static { /// NB: For efficiency reasons (avoiding making a second copy of the inline elements), this /// actually clears out the original array instead of moving it. - fn move_iter<'a>(&'a mut self) -> SmallVecMoveIterator<'a,T> { + fn into_iter<'a>(&'a mut self) -> SmallVecMoveIterator<'a,T> { unsafe { let iter = mem::transmute(self.iter()); let ptr_opt = if self.spilled() { @@ -136,7 +136,7 @@ pub trait SmallVec<T> : SmallVecPrivate<T> where T: 'static { } fn push_all_move<V:SmallVec<T>>(&mut self, mut other: V) { - for value in other.move_iter() { + for value in other.into_iter() { self.push(value) } } @@ -219,12 +219,12 @@ pub trait SmallVec<T> : SmallVecPrivate<T> where T: 'static { self.slice(0, self.len()) } - fn as_mut_slice<'a>(&'a mut self) -> &'a mut [T] { + fn as_slice_mut<'a>(&'a mut self) -> &'a mut [T] { let len = self.len(); - self.mut_slice(0, len) + self.slice_mut(0, len) } - fn mut_slice<'a>(&'a mut self, start: uint, end: uint) -> &'a mut [T] { + fn slice_mut<'a>(&'a mut self, start: uint, end: uint) -> &'a mut [T] { assert!(start <= end); assert!(end <= self.len()); unsafe { @@ -235,9 +235,9 @@ pub trait SmallVec<T> : SmallVecPrivate<T> where T: 'static { } } - fn mut_slice_from<'a>(&'a mut self, start: uint) -> &'a mut [T] { + fn slice_from_mut<'a>(&'a mut self, start: uint) -> &'a mut [T] { let len = self.len(); - self.mut_slice(start, len) + self.slice_mut(start, len) } fn fail_bounds_check(&self, index: uint) { @@ -400,8 +400,8 @@ macro_rules! def_small_vector( } #[inline] - fn vec_mut_slice<'a>(&'a mut self, start: uint, end: uint) -> &'a mut [T] { - self.mut_slice(start, end) + fn vec_slice_mut<'a>(&'a mut self, start: uint, end: uint) -> &'a mut [T] { + self.slice_mut(start, end) } } diff --git a/components/util/sort.rs b/components/util/sort.rs index 32dc52f6574..bf0c37d8ea6 100644 --- a/components/util/sort.rs +++ b/components/util/sort.rs @@ -91,7 +91,7 @@ pub mod test { let len: uint = rng.gen(); let mut v: Vec<int> = rng.gen_iter::<int>().take((len % 32) + 1).collect(); fn compare_ints(a: &int, b: &int) -> Ordering { a.cmp(b) } - sort::quicksort_by(v.as_mut_slice(), compare_ints); + sort::quicksort_by(v.as_slice_mut(), compare_ints); for i in range(0, v.len() - 1) { assert!(v.get(i) <= v.get(i + 1)) } diff --git a/components/util/time.rs b/components/util/time.rs index fd83eb34eb5..d3e9b5df65d 100644 --- a/components/util/time.rs +++ b/components/util/time.rs @@ -210,7 +210,7 @@ impl TimeProfiler { "_category_", "_incremental?_", "_iframe?_", " _url_", " _mean (ms)_", " _median (ms)_", " _min (ms)_", " _max (ms)_", " _events_"); - for (&(ref category, ref meta), ref mut data) in self.buckets.mut_iter() { + for (&(ref category, ref meta), ref mut data) in self.buckets.iter_mut() { data.sort_by(|a, b| { if a < b { Less diff --git a/components/util/workqueue.rs b/components/util/workqueue.rs index 9effab16551..4924036a6a8 100644 --- a/components/util/workqueue.rs +++ b/components/util/workqueue.rs @@ -229,7 +229,7 @@ impl<QueueData: Send, WorkData: Send> WorkQueue<QueueData, WorkData> { } // Spawn threads. - for thread in threads.move_iter() { + for thread in threads.into_iter() { TaskBuilder::new().named(task_name).native().spawn(proc() { let mut thread = thread; thread.start() @@ -260,8 +260,8 @@ impl<QueueData: Send, WorkData: Send> WorkQueue<QueueData, WorkData> { pub fn run(&mut self) { // Tell the workers to start. let mut work_count = AtomicUint::new(self.work_count); - for worker in self.workers.mut_iter() { - worker.chan.send(StartMsg(worker.deque.take_unwrap(), &mut work_count, &self.data)) + for worker in self.workers.iter_mut() { + worker.chan.send(StartMsg(worker.deque.take().unwrap(), &mut work_count, &self.data)) } // Wait for the work to finish. |