mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Eliminate warnings
This commit is contained in:
parent
2f46b9aede
commit
dc86e83654
57 changed files with 223 additions and 221 deletions
|
@ -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)
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 => {}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue