Skip to content

Commit

Permalink
Eliminate warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
kmcallister committed Sep 20, 2014
1 parent 2f46b9a commit dc86e83
Show file tree
Hide file tree
Showing 57 changed files with 223 additions and 221 deletions.
12 changes: 6 additions & 6 deletions components/compositing/compositor.rs
Expand Up @@ -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();
Expand Down Expand Up @@ -839,15 +839,15 @@ 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())
});

// 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();
}

Expand Down Expand Up @@ -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));
}
Expand Down Expand Up @@ -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,
Expand All @@ -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));
}
}
Expand Down
6 changes: 3 additions & 3 deletions components/compositing/compositor_data.rs
Expand Up @@ -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);
}

Expand All @@ -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()
}

Expand All @@ -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()
}
Expand Down
30 changes: 15 additions & 15 deletions components/compositing/constellation.rs
Expand Up @@ -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));
}
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -527,15 +527,15 @@ 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));
}
}

// 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));
}
}
Expand Down Expand Up @@ -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.");
Expand All @@ -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) {
Expand Down Expand Up @@ -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();
}
Expand All @@ -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();
}
Expand Down Expand Up @@ -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()
};
Expand All @@ -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 \
Expand Down
8 changes: 4 additions & 4 deletions components/gfx/buffer_map.rs
Expand Up @@ -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()
Expand All @@ -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;
Expand All @@ -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)
}
}
Expand Down
14 changes: 7 additions & 7 deletions components/gfx/display_list/mod.rs
Expand Up @@ -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,
Expand All @@ -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);
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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()))
}
Expand All @@ -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()))
}
Expand All @@ -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 => {}
Expand Down
4 changes: 2 additions & 2 deletions components/gfx/font.rs
Expand Up @@ -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)
})
}
Expand All @@ -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> {
Expand Down
4 changes: 2 additions & 2 deletions components/gfx/font_cache_task.rs
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion components/gfx/font_context.rs
Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion components/gfx/platform/freetype/font_list.rs
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions components/gfx/render_task.rs
Expand Up @@ -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 {
Expand All @@ -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);
}
}
Expand Down
6 changes: 3 additions & 3 deletions components/gfx/text/glyph.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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 => {
Expand Down

0 comments on commit dc86e83

Please sign in to comment.