Eliminate warnings

This commit is contained in:
Keegan McAllister 2014-09-18 16:29:46 -07:00
parent 2f46b9aede
commit dc86e83654
57 changed files with 223 additions and 221 deletions

View file

@ -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)
}
}

View file

@ -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 => {}

View file

@ -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> {

View file

@ -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;

View file

@ -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)
}

View file

@ -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;

View file

@ -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);
}
}

View file

@ -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 => {

View file

@ -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);

View file

@ -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 {