diff --git a/components/gfx/text/text_run.rs b/components/gfx/text/text_run.rs index 22dfa37533b..ec1fc7e2744 100644 --- a/components/gfx/text/text_run.rs +++ b/components/gfx/text/text_run.rs @@ -156,15 +156,14 @@ impl<'a> Iterator for CharacterSliceIterator<'a> { impl<'a> TextRun { pub fn new(font: &mut Font, text: String, options: &ShapingOptions, bidi_level: u8) -> TextRun { let glyphs = TextRun::break_and_shape(font, &text, options); - let run = TextRun { + TextRun { text: Arc::new(text), font_metrics: font.metrics.clone(), font_template: font.handle.template(), actual_pt_size: font.actual_pt_size, glyphs: Arc::new(glyphs), bidi_level: bidi_level, - }; - run + } } pub fn break_and_shape(font: &mut Font, text: &str, options: &ShapingOptions) diff --git a/components/layout/block.rs b/components/layout/block.rs index 8540d162525..be55574f316 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -627,11 +627,11 @@ impl BlockFlow { // Check if the transform matrix is 2D or 3D if let Some(ref transform_list) = self.fragment.style().get_effects().transform.0 { for transform in transform_list { - match transform { - &transform::ComputedOperation::Perspective(..) => { + match *transform { + transform::ComputedOperation::Perspective(..) => { return true; } - &transform::ComputedOperation::Matrix(m) => { + transform::ComputedOperation::Matrix(m) => { // See http://dev.w3.org/csswg/css-transforms/#2d-matrix if m.m31 != 0.0 || m.m32 != 0.0 || m.m13 != 0.0 || m.m23 != 0.0 || diff --git a/components/layout/construct.rs b/components/layout/construct.rs index eb43c81b93e..dd1d58a6acc 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -91,10 +91,10 @@ impl ConstructionResult { } pub fn debug_id(&self) -> usize { - match self { - &ConstructionResult::None => 0, - &ConstructionResult::ConstructionItem(_) => 0, - &ConstructionResult::Flow(ref flow_ref, _) => flow::base(&**flow_ref).debug_id(), + match *self { + ConstructionResult::None => 0, + ConstructionResult::ConstructionItem(_) => 0, + ConstructionResult::Flow(ref flow_ref, _) => flow::base(&**flow_ref).debug_id(), } } } @@ -1315,9 +1315,9 @@ impl<'a> FlowConstructor<'a> { let mut layout_data_ref = node.mutate_layout_data(); let layout_data = layout_data_ref.as_mut().expect("no layout data"); let damage = layout_data.data.restyle_damage; - match node.construction_result_mut(layout_data) { - &mut ConstructionResult::None => true, - &mut ConstructionResult::Flow(ref mut flow, _) => { + match *node.construction_result_mut(layout_data) { + ConstructionResult::None => true, + ConstructionResult::Flow(ref mut flow, _) => { // The node's flow is of the same type and has the same set of children and can // therefore be repaired by simply propagating damage and style to the flow. if !flow.is_block_flow() { @@ -1328,7 +1328,7 @@ impl<'a> FlowConstructor<'a> { flow.repair_style_and_bubble_inline_sizes(&style); true } - &mut ConstructionResult::ConstructionItem(ConstructionItem::InlineFragments( + ConstructionResult::ConstructionItem(ConstructionItem::InlineFragments( ref mut inline_fragments_construction_result)) => { if !inline_fragments_construction_result.splits.is_empty() { return false @@ -1384,7 +1384,7 @@ impl<'a> FlowConstructor<'a> { } true } - &mut ConstructionResult::ConstructionItem(_) => { + ConstructionResult::ConstructionItem(_) => { false } } @@ -1558,8 +1558,7 @@ trait NodeUtils { /// Returns true if this node doesn't render its kids and false otherwise. fn is_replaced_content(&self) -> bool; - fn construction_result_mut<'a>(self, layout_data: &'a mut LayoutDataWrapper) - -> &'a mut ConstructionResult; + fn construction_result_mut(self, layout_data: &mut LayoutDataWrapper) -> &mut ConstructionResult; /// Sets the construction result of a flow. fn set_flow_construction_result(self, result: ConstructionResult); @@ -1589,7 +1588,7 @@ impl<'ln> NodeUtils for ThreadSafeLayoutNode<'ln> { } } - fn construction_result_mut<'a>(self, layout_data: &'a mut LayoutDataWrapper) -> &'a mut ConstructionResult { + fn construction_result_mut(self, layout_data: &mut LayoutDataWrapper) -> &mut ConstructionResult { match self.get_pseudo_element_type() { PseudoElementType::Before(_) => &mut layout_data.data.before_flow_construction_result, PseudoElementType::After (_) => &mut layout_data.data.after_flow_construction_result, diff --git a/components/layout/css/matching.rs b/components/layout/css/matching.rs index f101fc321af..22d66bac70c 100644 --- a/components/layout/css/matching.rs +++ b/components/layout/css/matching.rs @@ -522,8 +522,8 @@ impl<'ln> PrivateMatchMethods for LayoutNode<'ln> { let parent_layout_data: &Option = unsafe { &*parent_node.borrow_layout_data_unchecked() }; - match parent_layout_data { - &Some(ref parent_layout_data_ref) => { + match *parent_layout_data { + Some(ref parent_layout_data_ref) => { // Check parent style. let parent_style = parent_layout_data_ref.shared_data.style.as_ref().unwrap(); if !arc_ptr_eq(parent_style, &candidate.parent_style) { @@ -678,9 +678,9 @@ impl<'ln> MatchMethods for LayoutNode<'ln> { }; let mut layout_data_ref = self.mutate_layout_data(); - match &mut *layout_data_ref { - &mut None => panic!("no layout data"), - &mut Some(ref mut layout_data) => { + match *layout_data_ref { + None => panic!("no layout data"), + Some(ref mut layout_data) => { match self.type_id() { NodeTypeId::CharacterData(CharacterDataTypeId::Text) => { // Text nodes get a copy of the parent style. This ensures diff --git a/components/layout/data.rs b/components/layout/data.rs index 097852096fa..e7a21be38a9 100644 --- a/components/layout/data.rs +++ b/components/layout/data.rs @@ -72,14 +72,14 @@ impl LayoutDataWrapper { flow_ref.remove_compositor_layers(constellation_chan); } ConstructionResult::ConstructionItem(ref construction_item) => { - match construction_item { - &ConstructionItem::InlineFragments(ref inline_fragments) => { + match *construction_item { + ConstructionItem::InlineFragments(ref inline_fragments) => { for fragment in &inline_fragments.fragments.fragments { fragment.remove_compositor_layers(constellation_chan.clone()); } } - &ConstructionItem::Whitespace(..) => {} - &ConstructionItem::TableColumnFragment(ref fragment) => { + ConstructionItem::Whitespace(..) => {} + ConstructionItem::TableColumnFragment(ref fragment) => { fragment.remove_compositor_layers(constellation_chan.clone()); } } diff --git a/components/layout/display_list_builder.rs b/components/layout/display_list_builder.rs index 9e82add3a12..69ab5ba6590 100644 --- a/components/layout/display_list_builder.rs +++ b/components/layout/display_list_builder.rs @@ -1202,27 +1202,27 @@ impl FragmentDisplayListBuilding for Fragment { -transform_origin.z); for operation in operations { - let matrix = match operation { - &transform::ComputedOperation::Rotate(ax, ay, az, theta) => { + let matrix = match *operation { + transform::ComputedOperation::Rotate(ax, ay, az, theta) => { let theta = 2.0f32 * f32::consts::PI - theta.radians(); Matrix4::create_rotation(ax, ay, az, theta) } - &transform::ComputedOperation::Perspective(d) => { + transform::ComputedOperation::Perspective(d) => { Matrix4::create_perspective(d.to_f32_px()) } - &transform::ComputedOperation::Scale(sx, sy, sz) => { + transform::ComputedOperation::Scale(sx, sy, sz) => { Matrix4::create_scale(sx, sy, sz) } - &transform::ComputedOperation::Translate(tx, ty, tz) => { + transform::ComputedOperation::Translate(tx, ty, tz) => { let tx = model::specified(tx, border_box.size.width).to_f32_px(); let ty = model::specified(ty, border_box.size.height).to_f32_px(); let tz = tz.to_f32_px(); Matrix4::create_translation(tx, ty, tz) } - &transform::ComputedOperation::Matrix(m) => { + transform::ComputedOperation::Matrix(m) => { m.to_gfx_matrix() } - &transform::ComputedOperation::Skew(sx, sy) => { + transform::ComputedOperation::Skew(sx, sy) => { Matrix4::create_skew(sx, sy) } }; diff --git a/components/layout/flex.rs b/components/layout/flex.rs index 1117c6b5df0..d9a9b5d9ff9 100644 --- a/components/layout/flex.rs +++ b/components/layout/flex.rs @@ -87,12 +87,10 @@ impl FlexFlow { flex_direction::T::column => Mode::Block }; - let this = FlexFlow { + FlexFlow { block_flow: BlockFlow::from_fragment(fragment, flotation), main_mode: main_mode - }; - - this + } } // TODO(zentner): This function should use flex-basis. diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs index fe826dfdaf2..fd31eb1074f 100644 --- a/components/layout/fragment.rs +++ b/components/layout/fragment.rs @@ -632,12 +632,10 @@ impl IframeFragmentInfo { }; let containing_size = containing_size.unwrap_or(Au(0)); - let size = clamp_size(computed_size, - style_min_size, - style_max_size, - containing_size); - - size + clamp_size(computed_size, + style_min_size, + style_max_size, + containing_size) } } diff --git a/components/layout/layout_debug.rs b/components/layout/layout_debug.rs index 3bc7ef8bf6b..93e68f7fbe0 100644 --- a/components/layout/layout_debug.rs +++ b/components/layout/layout_debug.rs @@ -63,13 +63,13 @@ struct State { impl Scope { pub fn new(name: String) -> Scope { STATE_KEY.with(|ref r| { - match &mut *r.borrow_mut() { - &mut Some(ref mut state) => { + match *r.borrow_mut() { + Some(ref mut state) => { let flow_trace = json::encode(&flow::base(&*state.flow_root)).unwrap(); let data = box ScopeData::new(name.clone(), flow_trace); state.scope_stack.push(data); } - &mut None => {} + None => {} } }); Scope @@ -80,14 +80,14 @@ impl Scope { impl Drop for Scope { fn drop(&mut self) { STATE_KEY.with(|ref r| { - match &mut *r.borrow_mut() { - &mut Some(ref mut state) => { + match *r.borrow_mut() { + Some(ref mut state) => { let mut current_scope = state.scope_stack.pop().unwrap(); current_scope.post = json::encode(&flow::base(&*state.flow_root)).unwrap(); let previous_scope = state.scope_stack.last_mut().unwrap(); previous_scope.children.push(current_scope); } - &mut None => {} + None => {} } }); } diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs index 0e02bccf0d6..d346e97a40e 100644 --- a/components/layout/wrapper.rs +++ b/components/layout/wrapper.rs @@ -857,8 +857,8 @@ impl<'ln> ThreadSafeLayoutNode<'ln> { /// Set the restyle damage field. pub fn set_restyle_damage(self, damage: RestyleDamage) { let mut layout_data_ref = self.mutate_layout_data(); - match &mut *layout_data_ref { - &mut Some(ref mut layout_data) => layout_data.data.restyle_damage = damage, + match *layout_data_ref { + Some(ref mut layout_data) => layout_data.data.restyle_damage = damage, _ => panic!("no layout data for this node"), } } @@ -876,8 +876,8 @@ impl<'ln> ThreadSafeLayoutNode<'ln> { /// Adds the given flags to this node. pub fn insert_flags(self, new_flags: LayoutDataFlags) { let mut layout_data_ref = self.mutate_layout_data(); - match &mut *layout_data_ref { - &mut Some(ref mut layout_data) => layout_data.data.flags.insert(new_flags), + match *layout_data_ref { + Some(ref mut layout_data) => layout_data.data.flags.insert(new_flags), _ => panic!("no layout data for this node"), } } @@ -885,8 +885,8 @@ impl<'ln> ThreadSafeLayoutNode<'ln> { /// Removes the given flags from this node. pub fn remove_flags(self, flags: LayoutDataFlags) { let mut layout_data_ref = self.mutate_layout_data(); - match &mut *layout_data_ref { - &mut Some(ref mut layout_data) => layout_data.data.flags.remove(flags), + match *layout_data_ref { + Some(ref mut layout_data) => layout_data.data.flags.remove(flags), _ => panic!("no layout data for this node"), } } diff --git a/components/script/dom/eventdispatcher.rs b/components/script/dom/eventdispatcher.rs index fba40538548..7ea4a706fea 100644 --- a/components/script/dom/eventdispatcher.rs +++ b/components/script/dom/eventdispatcher.rs @@ -13,9 +13,8 @@ use dom::node::Node; use dom::virtualmethods::vtable_for; // See https://dom.spec.whatwg.org/#concept-event-dispatch for the full dispatch algorithm -pub fn dispatch_event(target: &EventTarget, - pseudo_target: Option<&EventTarget>, - event: &Event) -> bool { +pub fn dispatch_event(target: &EventTarget, pseudo_target: Option<&EventTarget>, + event: &Event) -> bool { assert!(!event.dispatching()); assert!(event.initialized()); diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index 8cd6ae29cd8..d0facdaa1a5 100644 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -356,9 +356,8 @@ fn broadcast_radio_checked(broadcaster: &HTMLInputElement, group: Option<&str>) do_broadcast(doc_node, broadcaster, owner.r(), group) } -fn in_same_group(other: &HTMLInputElement, - owner: Option<&HTMLFormElement>, - group: Option<&str>) -> bool { +fn in_same_group(other: &HTMLInputElement, owner: Option<&HTMLFormElement>, + group: Option<&str>) -> bool { let other_owner = other.form_owner(); let other_owner = other_owner.r(); other.input_type.get() == InputType::InputRadio &&