diff --git a/components/gfx/display_list/mod.rs b/components/gfx/display_list/mod.rs index 9555a3fb98f..8df8f03b5b9 100644 --- a/components/gfx/display_list/mod.rs +++ b/components/gfx/display_list/mod.rs @@ -1115,7 +1115,7 @@ impl DisplayItem { } } - pub fn base<'a>(&'a self) -> &'a BaseDisplayItem { + pub fn base(&self) -> &BaseDisplayItem { match *self { DisplayItem::SolidColorClass(ref solid_color) => &solid_color.base, DisplayItem::TextClass(ref text) => &text.base, @@ -1127,7 +1127,7 @@ impl DisplayItem { } } - pub fn mut_base<'a>(&'a mut self) -> &'a mut BaseDisplayItem { + pub fn mut_base(&mut self) -> &mut BaseDisplayItem { match *self { DisplayItem::SolidColorClass(ref mut solid_color) => &mut solid_color.base, DisplayItem::TextClass(ref mut text) => &mut text.base, diff --git a/components/gfx/font.rs b/components/gfx/font.rs index 59e3cc37620..6fffb845106 100644 --- a/components/gfx/font.rs +++ b/components/gfx/font.rs @@ -178,7 +178,7 @@ impl Font { status, tag.tag_to_str(), self.handle.family_name(), self.handle.face_name()); - return result; + result } #[inline] diff --git a/components/gfx/paint_context.rs b/components/gfx/paint_context.rs index 2c38e0e6fea..0098adc813e 100644 --- a/components/gfx/paint_context.rs +++ b/components/gfx/paint_context.rs @@ -378,7 +378,7 @@ impl<'a> PaintContext<'a> { if discriminant == 0. { return (Some(x1), None); } - return (Some(x1), Some(x2)); + (Some(x1), Some(x2)) } fn intersect_ellipse_line(e: Ellipse, l: Line) -> (Option>, Option>) { @@ -1013,16 +1013,16 @@ impl<'a> PaintContext<'a> { let left_top = Point2D::new(rect.origin.x, rect.origin.y); let scaled_left_top = left_top + Point2D::new(scaled_border.left, scaled_border.top); - return Rect::new(scaled_left_top, - Size2D::new(rect.size.width - 2.0 * scaled_border.right, - rect.size.height - 2.0 * scaled_border.bottom)); + Rect::new(scaled_left_top, + Size2D::new(rect.size.width - 2.0 * scaled_border.right, + rect.size.height - 2.0 * scaled_border.bottom)) } fn scale_color(&self, color: Color, scale_factor: f32) -> Color { - return color::new(color.r * scale_factor, - color.g * scale_factor, - color.b * scale_factor, - color.a); + color::new(color.r * scale_factor, + color.g * scale_factor, + color.b * scale_factor, + color.a) } fn draw_double_border_segment(&self, diff --git a/components/gfx/text/text_run.rs b/components/gfx/text/text_run.rs index 258766ac08e..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, - }; - return 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 7288a11c902..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 || @@ -696,7 +696,7 @@ impl BlockFlow { } /// Return this flow's fragment. - pub fn fragment<'a>(&'a mut self) -> &'a mut Fragment { + pub fn fragment(&mut self) -> &mut Fragment { &mut self.fragment } @@ -1624,11 +1624,11 @@ impl Flow for BlockFlow { FlowClass::Block } - fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow { + fn as_mut_block(&mut self) -> &mut BlockFlow { self } - fn as_block<'a>(&'a self) -> &'a BlockFlow { + fn as_block(&self) -> &BlockFlow { self } 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 f10992526ce..22d66bac70c 100644 --- a/components/layout/css/matching.rs +++ b/components/layout/css/matching.rs @@ -113,7 +113,7 @@ impl<'a> PartialEq for ApplicableDeclarationsCacheQuery<'a> { return false } } - return true + true } } impl<'a> Eq for ApplicableDeclarationsCacheQuery<'a> {} @@ -348,7 +348,7 @@ impl StyleSharingCandidateCache { } } - pub fn iter<'a>(&'a self) -> Iter<'a, (StyleSharingCandidate, ())> { + pub fn iter(&self) -> Iter<(StyleSharingCandidate, ())> { self.cache.iter() } @@ -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 2cc2424a854..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. @@ -309,7 +307,7 @@ impl Flow for FlexFlow { FlowClass::Flex } - fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow { + fn as_mut_block(&mut self) -> &mut BlockFlow { &mut self.block_flow } diff --git a/components/layout/flow.rs b/components/layout/flow.rs index 932cab031d5..8629881d8e0 100644 --- a/components/layout/flow.rs +++ b/components/layout/flow.rs @@ -77,108 +77,108 @@ pub trait Flow: fmt::Debug + Sync + Send + 'static { fn class(&self) -> FlowClass; /// If this is a block flow, returns the underlying object. Fails otherwise. - fn as_block<'a>(&'a self) -> &'a BlockFlow { + fn as_block(&self) -> &BlockFlow { panic!("called as_block() on a non-block flow") } /// If this is a block flow, returns the underlying object, borrowed mutably. Fails otherwise. - fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow { + fn as_mut_block(&mut self) -> &mut BlockFlow { debug!("called as_mut_block() on a flow of type {:?}", self.class()); panic!("called as_mut_block() on a non-block flow") } /// If this is an inline flow, returns the underlying object. Fails otherwise. - fn as_inline<'a>(&'a self) -> &'a InlineFlow { + fn as_inline(&self) -> &InlineFlow { panic!("called as_inline() on a non-inline flow") } /// If this is an inline flow, returns the underlying object, borrowed mutably. Fails /// otherwise. - fn as_mut_inline<'a>(&'a mut self) -> &'a mut InlineFlow { + fn as_mut_inline(&mut self) -> &mut InlineFlow { panic!("called as_mut_inline() on a non-inline flow") } /// If this is a table wrapper flow, returns the underlying object, borrowed mutably. Fails /// otherwise. - fn as_mut_table_wrapper<'a>(&'a mut self) -> &'a mut TableWrapperFlow { + fn as_mut_table_wrapper(&mut self) -> &mut TableWrapperFlow { panic!("called as_mut_table_wrapper() on a non-tablewrapper flow") } /// If this is a table wrapper flow, returns the underlying object. Fails otherwise. - fn as_table_wrapper<'a>(&'a self) -> &'a TableWrapperFlow { + fn as_table_wrapper(&self) -> &TableWrapperFlow { panic!("called as_table_wrapper() on a non-tablewrapper flow") } /// If this is a table flow, returns the underlying object, borrowed mutably. Fails otherwise. - fn as_mut_table<'a>(&'a mut self) -> &'a mut TableFlow { + fn as_mut_table(&mut self) -> &mut TableFlow { panic!("called as_mut_table() on a non-table flow") } /// If this is a table flow, returns the underlying object. Fails otherwise. - fn as_table<'a>(&'a self) -> &'a TableFlow { + fn as_table(&self) -> &TableFlow { panic!("called as_table() on a non-table flow") } /// If this is a table colgroup flow, returns the underlying object, borrowed mutably. Fails /// otherwise. - fn as_mut_table_colgroup<'a>(&'a mut self) -> &'a mut TableColGroupFlow { + fn as_mut_table_colgroup(&mut self) -> &mut TableColGroupFlow { panic!("called as_mut_table_colgroup() on a non-tablecolgroup flow") } /// If this is a table rowgroup flow, returns the underlying object, borrowed mutably. Fails /// otherwise. - fn as_mut_table_rowgroup<'a>(&'a mut self) -> &'a mut TableRowGroupFlow { + fn as_mut_table_rowgroup(&mut self) -> &mut TableRowGroupFlow { panic!("called as_mut_table_rowgroup() on a non-tablerowgroup flow") } /// If this is a table rowgroup flow, returns the underlying object. Fails otherwise. - fn as_table_rowgroup<'a>(&'a self) -> &'a TableRowGroupFlow { + fn as_table_rowgroup(&self) -> &TableRowGroupFlow { panic!("called as_table_rowgroup() on a non-tablerowgroup flow") } /// If this is a table row flow, returns the underlying object, borrowed mutably. Fails /// otherwise. - fn as_mut_table_row<'a>(&'a mut self) -> &'a mut TableRowFlow { + fn as_mut_table_row(&mut self) -> &mut TableRowFlow { panic!("called as_mut_table_row() on a non-tablerow flow") } /// If this is a table row flow, returns the underlying object. Fails otherwise. - fn as_table_row<'a>(&'a self) -> &'a TableRowFlow { + fn as_table_row(&self) -> &TableRowFlow { panic!("called as_table_row() on a non-tablerow flow") } /// If this is a table cell flow, returns the underlying object, borrowed mutably. Fails /// otherwise. - fn as_mut_table_caption<'a>(&'a mut self) -> &'a mut TableCaptionFlow { + fn as_mut_table_caption(&mut self) -> &mut TableCaptionFlow { panic!("called as_mut_table_caption() on a non-tablecaption flow") } /// If this is a table cell flow, returns the underlying object, borrowed mutably. Fails /// otherwise. - fn as_mut_table_cell<'a>(&'a mut self) -> &'a mut TableCellFlow { + fn as_mut_table_cell(&mut self) -> &mut TableCellFlow { panic!("called as_mut_table_cell() on a non-tablecell flow") } /// If this is a multicol flow, returns the underlying object, borrowed mutably. Fails /// otherwise. - fn as_mut_multicol<'a>(&'a mut self) -> &'a mut MulticolFlow { + fn as_mut_multicol(&mut self) -> &mut MulticolFlow { panic!("called as_mut_multicol() on a non-multicol flow") } /// If this is a table cell flow, returns the underlying object. Fails otherwise. - fn as_table_cell<'a>(&'a self) -> &'a TableCellFlow { + fn as_table_cell(&self) -> &TableCellFlow { panic!("called as_table_cell() on a non-tablecell flow") } /// If this is a table row, table rowgroup, or table flow, returns column intrinsic /// inline-sizes. Fails otherwise. - fn column_intrinsic_inline_sizes<'a>(&'a mut self) -> &'a mut Vec { + fn column_intrinsic_inline_sizes(&mut self) -> &mut Vec { panic!("called column_intrinsic_inline_sizes() on non-table flow") } /// If this is a table row, table rowgroup, or table flow, returns column computed /// inline-sizes. Fails otherwise. - fn column_computed_inline_sizes<'a>(&'a mut self) -> &'a mut Vec { + fn column_computed_inline_sizes(&mut self) -> &mut Vec { panic!("called column_intrinsic_inline_sizes() on non-table flow") } @@ -756,7 +756,7 @@ impl AbsoluteDescendants { } /// Return an iterator over the descendant flows. - pub fn iter<'a>(&'a mut self) -> AbsoluteDescendantIter<'a> { + pub fn iter(&mut self) -> AbsoluteDescendantIter { AbsoluteDescendantIter { iter: self.descendant_links.iter_mut(), } @@ -1093,7 +1093,7 @@ impl BaseFlow { } } - pub fn child_iter<'a>(&'a mut self) -> MutFlowListIterator<'a> { + pub fn child_iter(&mut self) -> MutFlowListIterator { self.children.iter_mut() } @@ -1497,7 +1497,7 @@ impl ContainingBlockLink { } #[allow(unsafe_code)] - pub unsafe fn get<'a>(&'a mut self) -> &'a mut Option { + pub unsafe fn get(&mut self) -> &mut Option { &mut self.link } diff --git a/components/layout/flow_list.rs b/components/layout/flow_list.rs index 34fd5d80975..af54dddee9d 100644 --- a/components/layout/flow_list.rs +++ b/components/layout/flow_list.rs @@ -80,7 +80,7 @@ impl FlowList { /// Provide a forward iterator #[inline] - pub fn iter<'a>(&'a self) -> FlowListIterator<'a> { + pub fn iter(&self) -> FlowListIterator { FlowListIterator { it: self.flows.iter(), } @@ -88,7 +88,7 @@ impl FlowList { /// Provide a forward iterator with mutable references #[inline] - pub fn iter_mut<'a>(&'a mut self) -> MutFlowListIterator<'a> { + pub fn iter_mut(&mut self) -> MutFlowListIterator { MutFlowListIterator { it: self.flows.iter_mut(), } diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs index c11d9170679..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) } } @@ -1224,7 +1222,7 @@ impl Fragment { } #[inline(always)] - pub fn style<'a>(&'a self) -> &'a ComputedValues { + pub fn style(&self) -> &ComputedValues { &*self.style } diff --git a/components/layout/inline.rs b/components/layout/inline.rs index 6066b4a8473..22fe3054b63 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -841,12 +841,12 @@ impl InlineFragments { } /// A convenience function to return the fragment at a given index. - pub fn get<'a>(&'a self, index: usize) -> &'a Fragment { + pub fn get(&self, index: usize) -> &Fragment { &self.fragments[index] } /// A convenience function to return a mutable reference to the fragment at a given index. - pub fn get_mut<'a>(&'a mut self, index: usize) -> &'a mut Fragment { + pub fn get_mut(&mut self, index: usize) -> &mut Fragment { &mut self.fragments[index] } } @@ -1314,11 +1314,11 @@ impl Flow for InlineFlow { FlowClass::Inline } - fn as_inline<'a>(&'a self) -> &'a InlineFlow { + fn as_inline(&self) -> &InlineFlow { self } - fn as_mut_inline<'a>(&'a mut self) -> &'a mut InlineFlow { + fn as_mut_inline(&mut self) -> &mut InlineFlow { self } 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/layout_task.rs b/components/layout/layout_task.rs index a82914a692a..2c6dd56db12 100644 --- a/components/layout/layout_task.rs +++ b/components/layout/layout_task.rs @@ -1266,7 +1266,7 @@ impl LayoutTask { animation::tick_all_animations(self, &mut rw_data) } - pub fn tick_animations<'a>(&'a self, rw_data: &mut LayoutTaskData) { + pub fn tick_animations(&self, rw_data: &mut LayoutTaskData) { let reflow_info = Reflow { goal: ReflowGoal::ForDisplay, page_clip_rect: MAX_RECT, diff --git a/components/layout/list_item.rs b/components/layout/list_item.rs index 7ba0786f906..d120016dce7 100644 --- a/components/layout/list_item.rs +++ b/components/layout/list_item.rs @@ -68,11 +68,11 @@ impl Flow for ListItemFlow { FlowClass::ListItem } - fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow { + fn as_mut_block(&mut self) -> &mut BlockFlow { &mut self.block_flow } - fn as_block<'a>(&'a self) -> &'a BlockFlow { + fn as_block(&self) -> &BlockFlow { &self.block_flow } diff --git a/components/layout/multicol.rs b/components/layout/multicol.rs index 8a9738a6038..6de9e051b44 100644 --- a/components/layout/multicol.rs +++ b/components/layout/multicol.rs @@ -36,15 +36,15 @@ impl Flow for MulticolFlow { FlowClass::Multicol } - fn as_mut_multicol<'a>(&'a mut self) -> &'a mut MulticolFlow { + fn as_mut_multicol(&mut self) -> &mut MulticolFlow { self } - fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow { + fn as_mut_block(&mut self) -> &mut BlockFlow { &mut self.block_flow } - fn as_block<'a>(&'a self) -> &'a BlockFlow { + fn as_block(&self) -> &BlockFlow { &self.block_flow } diff --git a/components/layout/table.rs b/components/layout/table.rs index 50ce06c8959..b214e6d3ddc 100644 --- a/components/layout/table.rs +++ b/components/layout/table.rs @@ -191,15 +191,15 @@ impl Flow for TableFlow { FlowClass::Table } - fn as_mut_table<'a>(&'a mut self) -> &'a mut TableFlow { + fn as_mut_table(&mut self) -> &mut TableFlow { self } - fn as_table<'a>(&'a self) -> &'a TableFlow { + fn as_table(&self) -> &TableFlow { self } - fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow { + fn as_mut_block(&mut self) -> &mut BlockFlow { &mut self.block_flow } @@ -211,11 +211,11 @@ impl Flow for TableFlow { self.block_flow.mark_as_root(); } - fn column_intrinsic_inline_sizes<'a>(&'a mut self) -> &'a mut Vec { + fn column_intrinsic_inline_sizes(&mut self) -> &mut Vec { &mut self.column_intrinsic_inline_sizes } - fn column_computed_inline_sizes<'a>(&'a mut self) -> &'a mut Vec { + fn column_computed_inline_sizes(&mut self) -> &mut Vec { &mut self.column_computed_inline_sizes } diff --git a/components/layout/table_caption.rs b/components/layout/table_caption.rs index 460478790c6..afce73b44c5 100644 --- a/components/layout/table_caption.rs +++ b/components/layout/table_caption.rs @@ -36,11 +36,11 @@ impl Flow for TableCaptionFlow { FlowClass::TableCaption } - fn as_mut_table_caption<'a>(&'a mut self) -> &'a mut TableCaptionFlow { + fn as_mut_table_caption(&mut self) -> &mut TableCaptionFlow { self } - fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow { + fn as_mut_block(&mut self) -> &mut BlockFlow { &mut self.block_flow } diff --git a/components/layout/table_cell.rs b/components/layout/table_cell.rs index fcb54b0d9ab..f0f1495d8bb 100644 --- a/components/layout/table_cell.rs +++ b/components/layout/table_cell.rs @@ -59,11 +59,11 @@ impl TableCellFlow { } } - pub fn fragment<'a>(&'a mut self) -> &'a Fragment { + pub fn fragment(&mut self) -> &Fragment { &self.block_flow.fragment } - pub fn mut_fragment<'a>(&'a mut self) -> &'a mut Fragment { + pub fn mut_fragment(&mut self) -> &mut Fragment { &mut self.block_flow.fragment } @@ -84,15 +84,15 @@ impl Flow for TableCellFlow { FlowClass::TableCell } - fn as_mut_table_cell<'a>(&'a mut self) -> &'a mut TableCellFlow { + fn as_mut_table_cell(&mut self) -> &mut TableCellFlow { self } - fn as_table_cell<'a>(&'a self) -> &'a TableCellFlow { + fn as_table_cell(&self) -> &TableCellFlow { self } - fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow { + fn as_mut_block(&mut self) -> &mut BlockFlow { &mut self.block_flow } diff --git a/components/layout/table_colgroup.rs b/components/layout/table_colgroup.rs index aacff8cc011..f62083cc649 100644 --- a/components/layout/table_colgroup.rs +++ b/components/layout/table_colgroup.rs @@ -56,7 +56,7 @@ impl Flow for TableColGroupFlow { FlowClass::TableColGroup } - fn as_mut_table_colgroup<'a>(&'a mut self) -> &'a mut TableColGroupFlow { + fn as_mut_table_colgroup(&mut self) -> &mut TableColGroupFlow { self } diff --git a/components/layout/table_row.rs b/components/layout/table_row.rs index 315f5bc3347..5a4d10b47d7 100644 --- a/components/layout/table_row.rs +++ b/components/layout/table_row.rs @@ -96,7 +96,7 @@ impl TableRowFlow { } } - pub fn fragment<'a>(&'a mut self) -> &'a Fragment { + pub fn fragment(&mut self) -> &Fragment { &self.block_flow.fragment } @@ -107,7 +107,7 @@ impl TableRowFlow { /// inline(always) because this is only ever called by in-order or non-in-order top-level /// methods #[inline(always)] - fn assign_block_size_table_row_base<'a>(&mut self, layout_context: &'a LayoutContext<'a>) { + fn assign_block_size_table_row_base(&mut self, layout_context: &LayoutContext) { // Per CSS 2.1 ยง 17.5.3, find max_y = max(computed `block-size`, minimum block-size of all // cells). let mut max_block_size = Au(0); @@ -202,15 +202,15 @@ impl Flow for TableRowFlow { FlowClass::TableRow } - fn as_mut_table_row<'a>(&'a mut self) -> &'a mut TableRowFlow { + fn as_mut_table_row(&mut self) -> &mut TableRowFlow { self } - fn as_table_row<'a>(&'a self) -> &'a TableRowFlow { + fn as_table_row(&self) -> &TableRowFlow { self } - fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow { + fn as_mut_block(&mut self) -> &mut BlockFlow { &mut self.block_flow } @@ -218,11 +218,11 @@ impl Flow for TableRowFlow { &self.block_flow } - fn column_intrinsic_inline_sizes<'a>(&'a mut self) -> &'a mut Vec { + fn column_intrinsic_inline_sizes(&mut self) -> &mut Vec { panic!("can't call column_intrinsic_inline_sizes() on table row") } - fn column_computed_inline_sizes<'a>(&'a mut self) -> &'a mut Vec { + fn column_computed_inline_sizes(&mut self) -> &mut Vec { &mut self.column_computed_inline_sizes } @@ -407,7 +407,7 @@ impl Flow for TableRowFlow { }) } - fn assign_block_size<'a>(&mut self, layout_context: &'a LayoutContext<'a>) { + fn assign_block_size(&mut self, layout_context: &LayoutContext) { debug!("assign_block_size: assigning block_size for table_row"); self.assign_block_size_table_row_base(layout_context); } diff --git a/components/layout/table_rowgroup.rs b/components/layout/table_rowgroup.rs index a085cd173fe..9c91ea1f3bb 100644 --- a/components/layout/table_rowgroup.rs +++ b/components/layout/table_rowgroup.rs @@ -79,7 +79,7 @@ impl TableRowGroupFlow { } } - pub fn fragment<'a>(&'a mut self) -> &'a Fragment { + pub fn fragment(&mut self) -> &Fragment { &self.block_flow.fragment } @@ -112,15 +112,15 @@ impl Flow for TableRowGroupFlow { FlowClass::TableRowGroup } - fn as_mut_table_rowgroup<'a>(&'a mut self) -> &'a mut TableRowGroupFlow { + fn as_mut_table_rowgroup(&mut self) -> &mut TableRowGroupFlow { self } - fn as_table_rowgroup<'a>(&'a self) -> &'a TableRowGroupFlow { + fn as_table_rowgroup(&self) -> &TableRowGroupFlow { self } - fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow { + fn as_mut_block(&mut self) -> &mut BlockFlow { &mut self.block_flow } @@ -128,11 +128,11 @@ impl Flow for TableRowGroupFlow { &self.block_flow } - fn column_intrinsic_inline_sizes<'a>(&'a mut self) -> &'a mut Vec { + fn column_intrinsic_inline_sizes(&mut self) -> &mut Vec { &mut self.column_intrinsic_inline_sizes } - fn column_computed_inline_sizes<'a>(&'a mut self) -> &'a mut Vec { + fn column_computed_inline_sizes(&mut self) -> &mut Vec { &mut self.column_computed_inline_sizes } diff --git a/components/layout/table_wrapper.rs b/components/layout/table_wrapper.rs index ebf96020634..9ed64e8ec6a 100644 --- a/components/layout/table_wrapper.rs +++ b/components/layout/table_wrapper.rs @@ -285,19 +285,19 @@ impl Flow for TableWrapperFlow { FlowClass::TableWrapper } - fn as_mut_table_wrapper<'a>(&'a mut self) -> &'a mut TableWrapperFlow { + fn as_mut_table_wrapper(&mut self) -> &mut TableWrapperFlow { self } - fn as_table_wrapper<'a>(&'a self) -> &'a TableWrapperFlow { + fn as_table_wrapper(&self) -> &TableWrapperFlow { self } - fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow { + fn as_mut_block(&mut self) -> &mut BlockFlow { &mut self.block_flow } - fn as_block<'a>(&'a self) -> &'a BlockFlow { + fn as_block(&self) -> &BlockFlow { &self.block_flow } diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs index ca7d6142be4..d346e97a40e 100644 --- a/components/layout/wrapper.rs +++ b/components/layout/wrapper.rs @@ -160,7 +160,7 @@ impl<'ln> LayoutNode<'ln> { /// Returns the interior of this node as a `LayoutJS`. This is highly unsafe for layout to /// call and as such is marked `unsafe`. - unsafe fn get_jsmanaged<'a>(&'a self) -> &'a LayoutJS { + unsafe fn get_jsmanaged(&self) -> &LayoutJS { &self.node } @@ -280,7 +280,7 @@ impl<'ln> LayoutNode<'ln> { /// Borrows the layout data immutably. Fails on a conflicting borrow. #[inline(always)] - pub fn borrow_layout_data<'a>(&'a self) -> Ref<'a, Option> { + pub fn borrow_layout_data(&self) -> Ref> { unsafe { mem::transmute(self.get_jsmanaged().layout_data()) } @@ -288,7 +288,7 @@ impl<'ln> LayoutNode<'ln> { /// Borrows the layout data mutably. Fails on a conflicting borrow. #[inline(always)] - pub fn mutate_layout_data<'a>(&'a self) -> RefMut<'a, Option> { + pub fn mutate_layout_data(&self) -> RefMut> { unsafe { mem::transmute(self.get_jsmanaged().layout_data_mut()) } @@ -431,12 +431,12 @@ impl<'le> ::selectors::Element for LayoutElement<'le> { } #[inline] - fn get_local_name<'a>(&'a self) -> &'a Atom { + fn get_local_name(&self) -> &Atom { self.element.local_name() } #[inline] - fn get_namespace<'a>(&'a self) -> &'a Namespace { + fn get_namespace(&self) -> &Namespace { self.element.namespace() } @@ -666,7 +666,7 @@ impl<'ln> ThreadSafeLayoutNode<'ln> { /// Returns the interior of this node as a `LayoutJS`. This is highly unsafe for layout to /// call and as such is marked `unsafe`. - unsafe fn get_jsmanaged<'a>(&'a self) -> &'a LayoutJS { + unsafe fn get_jsmanaged(&self) -> &LayoutJS { self.node.get_jsmanaged() } @@ -739,7 +739,7 @@ impl<'ln> ThreadSafeLayoutNode<'ln> { /// Borrows the layout data without checking. #[inline(always)] - fn borrow_layout_data_unchecked<'a>(&'a self) -> *const Option { + fn borrow_layout_data_unchecked(&self) -> *const Option { unsafe { self.node.borrow_layout_data_unchecked() } @@ -749,7 +749,7 @@ impl<'ln> ThreadSafeLayoutNode<'ln> { /// /// TODO(pcwalton): Make this private. It will let us avoid borrow flag checks in some cases. #[inline(always)] - pub fn borrow_layout_data<'a>(&'a self) -> Ref<'a, Option> { + pub fn borrow_layout_data(&self) -> Ref> { self.node.borrow_layout_data() } @@ -757,14 +757,14 @@ impl<'ln> ThreadSafeLayoutNode<'ln> { /// /// TODO(pcwalton): Make this private. It will let us avoid borrow flag checks in some cases. #[inline(always)] - pub fn mutate_layout_data<'a>(&'a self) -> RefMut<'a, Option> { + pub fn mutate_layout_data(&self) -> RefMut> { self.node.mutate_layout_data() } /// Returns the style results for the given node. If CSS selector matching /// has not yet been performed, fails. #[inline] - pub fn style<'a>(&'a self) -> Ref<'a, Arc> { + pub fn style(&self) -> Ref> { Ref::map(self.borrow_layout_data(), |layout_data_ref| { let layout_data = layout_data_ref.as_ref().expect("no layout data"); let style = match self.get_pseudo_element_type() { @@ -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"), } } @@ -1000,8 +1000,8 @@ pub struct ThreadSafeLayoutNodeChildrenIterator<'a> { impl<'a> ThreadSafeLayoutNodeChildrenIterator<'a> { fn new(parent: ThreadSafeLayoutNode<'a>) -> ThreadSafeLayoutNodeChildrenIterator<'a> { - fn first_child<'a>(parent: ThreadSafeLayoutNode<'a>) - -> Option> { + fn first_child(parent: ThreadSafeLayoutNode) + -> Option { if parent.pseudo != PseudoElementType::Normal { return None } diff --git a/components/script/dom/activation.rs b/components/script/dom/activation.rs index 441871f9abe..d14861ed686 100644 --- a/components/script/dom/activation.rs +++ b/components/script/dom/activation.rs @@ -14,7 +14,7 @@ use std::borrow::ToOwned; /// Trait for elements with defined activation behavior pub trait Activatable { - fn as_element<'a>(&'a self) -> &'a Element; + fn as_element(&self) -> ∈ // Is this particular instance of the element activatable? fn is_instance_activatable(&self) -> bool; diff --git a/components/script/dom/attr.rs b/components/script/dom/attr.rs index 4c5f2c09d80..32178148ccf 100644 --- a/components/script/dom/attr.rs +++ b/components/script/dom/attr.rs @@ -75,14 +75,14 @@ impl AttrValue { AttrValue::Atom(value) } - pub fn as_tokens<'a>(&'a self) -> &'a [Atom] { + pub fn as_tokens(&self) -> &[Atom] { match *self { AttrValue::TokenList(_, ref tokens) => tokens, _ => panic!("Tokens not found"), } } - pub fn as_atom<'a>(&'a self) -> &'a Atom { + pub fn as_atom(&self) -> &Atom { match *self { AttrValue::Atom(ref value) => value, _ => panic!("Atom not found"), @@ -104,7 +104,7 @@ impl AttrValue { impl Deref for AttrValue { type Target = str; - fn deref<'a>(&'a self) -> &'a str { + fn deref(&self) -> &str { match *self { AttrValue::String(ref value) | AttrValue::TokenList(ref value, _) | @@ -152,17 +152,17 @@ impl Attr { } #[inline] - pub fn name<'a>(&'a self) -> &'a Atom { + pub fn name(&self) -> &Atom { &self.name } #[inline] - pub fn namespace<'a>(&'a self) -> &'a Namespace { + pub fn namespace(&self) -> &Namespace { &self.namespace } #[inline] - pub fn prefix<'a>(&'a self) -> &'a Option { + pub fn prefix(&self) -> &Option { &self.prefix } } diff --git a/components/script/dom/bindings/cell.rs b/components/script/dom/bindings/cell.rs index 80bab8839bc..e2cbe4bfef5 100644 --- a/components/script/dom/bindings/cell.rs +++ b/components/script/dom/bindings/cell.rs @@ -29,7 +29,7 @@ impl DOMRefCell { /// /// For use in the layout task only. #[allow(unsafe_code)] - pub unsafe fn borrow_for_layout<'a>(&'a self) -> &'a T { + pub unsafe fn borrow_for_layout(&self) -> &T { debug_assert!(task_state::get().is_layout()); &*self.value.as_unsafe_cell().get() } @@ -39,7 +39,7 @@ impl DOMRefCell { /// This succeeds even if the object is mutably borrowed, /// so you have to be careful in trace code! #[allow(unsafe_code)] - pub unsafe fn borrow_for_gc_trace<'a>(&'a self) -> &'a T { + pub unsafe fn borrow_for_gc_trace(&self) -> &T { // FIXME: IN_GC isn't reliable enough - doesn't catch minor GCs // https://github.com/servo/servo/issues/6389 //debug_assert!(task_state::get().contains(SCRIPT | IN_GC)); @@ -49,7 +49,7 @@ impl DOMRefCell { /// Borrow the contents for the purpose of script deallocation. /// #[allow(unsafe_code)] - pub unsafe fn borrow_for_script_deallocation<'a>(&'a self) -> &'a mut T { + pub unsafe fn borrow_for_script_deallocation(&self) -> &mut T { debug_assert!(task_state::get().contains(SCRIPT)); &mut *self.value.as_unsafe_cell().get() } @@ -71,7 +71,7 @@ impl DOMRefCell { /// # Panics /// /// Panics if this is called off the script thread. - pub fn try_borrow<'a>(&'a self) -> Option> { + pub fn try_borrow(&self) -> Option> { debug_assert!(task_state::get().is_script()); match self.value.borrow_state() { BorrowState::Writing => None, @@ -89,7 +89,7 @@ impl DOMRefCell { /// # Panics /// /// Panics if this is called off the script thread. - pub fn try_borrow_mut<'a>(&'a self) -> Option> { + pub fn try_borrow_mut(&self) -> Option> { debug_assert!(task_state::get().is_script()); match self.value.borrow_state() { BorrowState::Unused => Some(self.value.borrow_mut()), @@ -127,7 +127,7 @@ impl DOMRefCell { /// Panics if this is called off the script thread. /// /// Panics if the value is currently mutably borrowed. - pub fn borrow<'a>(&'a self) -> Ref<'a, T> { + pub fn borrow(&self) -> Ref { self.try_borrow().expect("DOMRefCell already mutably borrowed") } @@ -141,7 +141,7 @@ impl DOMRefCell { /// Panics if this is called off the script thread. /// /// Panics if the value is currently borrowed. - pub fn borrow_mut<'a>(&'a self) -> RefMut<'a, T> { + pub fn borrow_mut(&self) -> RefMut { self.try_borrow_mut().expect("DOMRefCell already borrowed") } } diff --git a/components/script/dom/bindings/conversions.rs b/components/script/dom/bindings/conversions.rs index 46e9d908ac3..35f7be92b94 100644 --- a/components/script/dom/bindings/conversions.rs +++ b/components/script/dom/bindings/conversions.rs @@ -661,7 +661,7 @@ unsafe fn get_dom_class(obj: *mut JSObject) -> Result { return Ok(*dom_class); } debug!("not a dom object"); - return Err(()); + Err(()) } /// Get a `*const libc::c_void` for the given DOM object, unwrapping any diff --git a/components/script/dom/bindings/global.rs b/components/script/dom/bindings/global.rs index ef9e8ef82c9..f968305e08b 100644 --- a/components/script/dom/bindings/global.rs +++ b/components/script/dom/bindings/global.rs @@ -204,7 +204,7 @@ impl<'a> Reflectable for GlobalRef<'a> { impl GlobalRoot { /// Obtain a safe reference to the global object that cannot outlive the /// lifetime of this root. - pub fn r<'c>(&'c self) -> GlobalRef<'c> { + pub fn r(&self) -> GlobalRef { match *self { GlobalRoot::Window(ref window) => GlobalRef::Window(window.r()), GlobalRoot::Worker(ref worker) => GlobalRef::Worker(worker.r()), diff --git a/components/script/dom/bindings/js.rs b/components/script/dom/bindings/js.rs index feb3a67d51f..5345d08ee9e 100644 --- a/components/script/dom/bindings/js.rs +++ b/components/script/dom/bindings/js.rs @@ -149,7 +149,7 @@ impl LayoutJS { } impl Reflectable for JS { - fn reflector<'a>(&'a self) -> &'a Reflector { + fn reflector(&self) -> &Reflector { unsafe { (**self.ptr).reflector() } @@ -310,11 +310,11 @@ impl LayoutJS { pub trait RootedReference { /// Obtain a safe optional reference to the wrapped JS owned-value that /// cannot outlive the lifetime of this root. - fn r<'a>(&'a self) -> Option<&'a T>; + fn r(&self) -> Option<&T>; } impl RootedReference for Option> { - fn r<'a>(&'a self) -> Option<&'a T> { + fn r(&self) -> Option<&T> { self.as_ref().map(|root| root.r()) } } @@ -323,11 +323,11 @@ impl RootedReference for Option> { pub trait OptionalRootedReference { /// Obtain a safe optional optional reference to the wrapped JS owned-value /// that cannot outlive the lifetime of this root. - fn r<'a>(&'a self) -> Option>; + fn r(&self) -> Option>; } impl OptionalRootedReference for Option>> { - fn r<'a>(&'a self) -> Option> { + fn r(&self) -> Option> { self.as_ref().map(|inner| inner.r()) } } @@ -430,7 +430,7 @@ impl Root { /// Obtain a safe reference to the wrapped JS owned-value that cannot /// outlive the lifetime of this root. - pub fn r<'a>(&'a self) -> &'a T { + pub fn r(&self) -> &T { &**self } @@ -443,7 +443,7 @@ impl Root { impl Deref for Root { type Target = T; - fn deref<'a>(&'a self) -> &'a T { + fn deref(&self) -> &T { unsafe { &**self.ptr.deref() } } } diff --git a/components/script/dom/bindings/proxyhandler.rs b/components/script/dom/bindings/proxyhandler.rs index 2dde7370442..66240df0d2c 100644 --- a/components/script/dom/bindings/proxyhandler.rs +++ b/components/script/dom/bindings/proxyhandler.rs @@ -87,14 +87,14 @@ pub unsafe extern fn prevent_extensions(_cx: *mut JSContext, _proxy: HandleObject, result: *mut ObjectOpResult) -> u8 { (*result).code_ = JSErrNum::JSMSG_CANT_PREVENT_EXTENSIONS as u32; - return JSTrue; + JSTrue } /// Reports whether the object is Extensible pub unsafe extern fn is_extensible(_cx: *mut JSContext, _proxy: HandleObject, succeeded: *mut u8) -> u8 { *succeeded = JSTrue; - return JSTrue; + JSTrue } /// Get the expando object, or null if there is none. @@ -123,7 +123,7 @@ pub fn ensure_expando_object(cx: *mut JSContext, obj: HandleObject) SetProxyExtra(obj.get(), JSPROXYSLOT_EXPANDO, ObjectValue(&*expando)); } - return expando; + expando } } diff --git a/components/script/dom/bindings/str.rs b/components/script/dom/bindings/str.rs index 6c7fea1dc10..ee6514bffbd 100644 --- a/components/script/dom/bindings/str.rs +++ b/components/script/dom/bindings/str.rs @@ -25,7 +25,7 @@ impl ByteString { /// Returns `self` as a string, if it encodes valid UTF-8, and `None` /// otherwise. - pub fn as_str<'a>(&'a self) -> Option<&'a str> { + pub fn as_str(&self) -> Option<&str> { let ByteString(ref vec) = *self; str::from_utf8(&vec).ok() } diff --git a/components/script/dom/bindings/utils.rs b/components/script/dom/bindings/utils.rs index d7912ae9af4..08e8fde7225 100644 --- a/components/script/dom/bindings/utils.rs +++ b/components/script/dom/bindings/utils.rs @@ -381,7 +381,7 @@ fn create_interface_prototype_object(cx: *mut JSContext, global: HandleObject, pub unsafe extern fn throwing_constructor(cx: *mut JSContext, _argc: c_uint, _vp: *mut JSVal) -> u8 { throw_type_error(cx, "Illegal constructor."); - return 0; + 0 } /// An array of *mut JSObject of size PrototypeList::ID::Count @@ -404,7 +404,7 @@ pub fn initialize_global(global: *mut JSObject) { /// A trait to provide access to the `Reflector` for a DOM object. pub trait Reflectable { /// Returns the receiver's reflector. - fn reflector<'a>(&'a self) -> &'a Reflector; + fn reflector(&self) -> &Reflector; /// Initializes the Reflector fn init_reflector(&mut self, _obj: *mut JSObject) { panic!("Cannot call init on this Reflectable"); @@ -507,7 +507,7 @@ pub fn get_array_index_from_id(_cx: *mut JSContext, id: HandleId) -> Option if RUST_JSID_IS_INT(id) != 0 { return Some(RUST_JSID_TO_INT(id) as u32); } - return None; + None } // if id is length atom, -1, otherwise /*return if JSID_IS_ATOM(id) { @@ -559,7 +559,7 @@ pub fn is_platform_object(obj: *mut JSObject) -> bool { clasp = js::jsapi::JS_GetClass(obj); } // TODO also check if JS_IsArrayBufferObject - return is_dom_class(&*clasp); + is_dom_class(&*clasp) } } @@ -631,8 +631,8 @@ pub fn has_property_on_prototype(cx: *mut JSContext, proxy: HandleObject, id: HandleId) -> bool { // MOZ_ASSERT(js::IsProxy(proxy) && js::GetProxyHandler(proxy) == handler); let mut found = false; - return !get_property_on_prototype(cx, proxy, id, &mut found, - MutableHandleValue { ptr: ptr::null_mut() }) || found; + !get_property_on_prototype(cx, proxy, id, &mut found, + MutableHandleValue { ptr: ptr::null_mut() }) || found } /// Create a DOM global object with the given class. @@ -812,11 +812,11 @@ pub fn validate_qualified_name(qualified_name: &str) -> ErrorResult { match xml_name_type(qualified_name) { XMLName::InvalidXMLName => { // Step 1. - return Err(Error::InvalidCharacter); + Err(Error::InvalidCharacter) }, XMLName::Name => { // Step 2. - return Err(Error::Namespace); + Err(Error::Namespace) }, XMLName::QName => Ok(()) } diff --git a/components/script/dom/blob.rs b/components/script/dom/blob.rs index 7e101dc4070..154cb6f43c4 100644 --- a/components/script/dom/blob.rs +++ b/components/script/dom/blob.rs @@ -37,7 +37,7 @@ pub struct Blob { fn is_ascii_printable(string: &DOMString) -> bool { // Step 5.1 in Sec 5.1 of File API spec // http://dev.w3.org/2006/webapi/FileAPI/#constructorBlob - return string.chars().all(|c| { c >= '\x20' && c <= '\x7E' }) + string.chars().all(|c| { c >= '\x20' && c <= '\x7E' }) } impl Blob { diff --git a/components/script/dom/browsercontext.rs b/components/script/dom/browsercontext.rs index 3f6f1c0ebfb..a0249d37202 100644 --- a/components/script/dom/browsercontext.rs +++ b/components/script/dom/browsercontext.rs @@ -177,7 +177,7 @@ unsafe extern fn hasOwn(cx: *mut JSContext, proxy: HandleObject, id: HandleId, b } *bp = (found != 0) as u8; - return JSTrue; + JSTrue } #[allow(unsafe_code)] diff --git a/components/script/dom/characterdata.rs b/components/script/dom/characterdata.rs index d9c558ee2e8..3efcd7c16c2 100644 --- a/components/script/dom/characterdata.rs +++ b/components/script/dom/characterdata.rs @@ -179,13 +179,13 @@ impl CharacterData { #[allow(unsafe_code)] pub trait LayoutCharacterDataHelpers { - unsafe fn data_for_layout<'a>(&'a self) -> &'a str; + unsafe fn data_for_layout(&self) -> &str; } #[allow(unsafe_code)] impl LayoutCharacterDataHelpers for LayoutJS { #[inline] - unsafe fn data_for_layout<'a>(&'a self) -> &'a str { + unsafe fn data_for_layout(&self) -> &str { &(*self.unsafe_get()).data.borrow_for_layout() } } diff --git a/components/script/dom/dedicatedworkerglobalscope.rs b/components/script/dom/dedicatedworkerglobalscope.rs index d4a3b216914..a3c033e56a6 100644 --- a/components/script/dom/dedicatedworkerglobalscope.rs +++ b/components/script/dom/dedicatedworkerglobalscope.rs @@ -62,7 +62,7 @@ pub struct SendableWorkerScriptChan { impl ScriptChan for SendableWorkerScriptChan { fn send(&self, msg: CommonScriptMsg) -> Result<(), ()> { - return self.sender.send((self.worker.clone(), msg)).map_err(|_| ()); + self.sender.send((self.worker.clone(), msg)).map_err(|_| ()) } fn clone(&self) -> Box { @@ -84,9 +84,9 @@ pub struct WorkerThreadWorkerChan { impl ScriptChan for WorkerThreadWorkerChan { fn send(&self, msg: CommonScriptMsg) -> Result<(), ()> { - return self.sender + self.sender .send((self.worker.clone(), WorkerScriptMsg::Common(msg))) - .map_err(|_| ()); + .map_err(|_| ()) } fn clone(&self) -> Box { diff --git a/components/script/dom/documenttype.rs b/components/script/dom/documenttype.rs index 265c918b466..0d91cdedb1a 100644 --- a/components/script/dom/documenttype.rs +++ b/components/script/dom/documenttype.rs @@ -58,17 +58,17 @@ impl DocumentType { } #[inline] - pub fn name<'a>(&'a self) -> &'a DOMString { + pub fn name(&self) -> &DOMString { &self.name } #[inline] - pub fn public_id<'a>(&'a self) -> &'a DOMString { + pub fn public_id(&self) -> &DOMString { &self.public_id } #[inline] - pub fn system_id<'a>(&'a self) -> &'a DOMString { + pub fn system_id(&self) -> &DOMString { &self.system_id } } diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index f9d3920cfd3..3d79189a07e 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -494,8 +494,8 @@ pub trait LayoutElementHelpers { #[allow(unsafe_code)] unsafe fn has_attr_for_layout(&self, namespace: &Namespace, name: &Atom) -> bool; fn style_attribute(&self) -> *const Option; - fn local_name<'a>(&'a self) -> &'a Atom; - fn namespace<'a>(&'a self) -> &'a Namespace; + fn local_name(&self) -> &Atom; + fn namespace(&self) -> &Namespace; fn get_checked_state_for_layout(&self) -> bool; fn get_indeterminate_state_for_layout(&self) -> bool; } @@ -524,14 +524,14 @@ impl LayoutElementHelpers for LayoutJS { } #[allow(unsafe_code)] - fn local_name<'a>(&'a self) -> &'a Atom { + fn local_name(&self) -> &Atom { unsafe { &(*self.unsafe_get()).local_name } } #[allow(unsafe_code)] - fn namespace<'a>(&'a self) -> &'a Namespace { + fn namespace(&self) -> &Namespace { unsafe { &(*self.unsafe_get()).namespace } diff --git a/components/script/dom/event.rs b/components/script/dom/event.rs index 58b45932cd8..d45407a51fe 100644 --- a/components/script/dom/event.rs +++ b/components/script/dom/event.rs @@ -117,7 +117,7 @@ impl Event { } #[inline] - pub fn type_id<'a>(&'a self) -> &'a EventTypeId { + pub fn type_id(&self) -> &EventTypeId { &self.type_id } diff --git a/components/script/dom/eventdispatcher.rs b/components/script/dom/eventdispatcher.rs index 024ba6a1350..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<'a, 'b>(target: &'a EventTarget, - pseudo_target: Option<&'b 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/eventtarget.rs b/components/script/dom/eventtarget.rs index 704ea280613..f2f228f2c0d 100644 --- a/components/script/dom/eventtarget.rs +++ b/components/script/dom/eventtarget.rs @@ -160,7 +160,7 @@ impl EventTarget { } #[inline] - pub fn type_id<'a>(&'a self) -> &'a EventTargetTypeId { + pub fn type_id(&self) -> &EventTargetTypeId { &self.type_id } diff --git a/components/script/dom/file.rs b/components/script/dom/file.rs index 8da50b26b13..f6b48927409 100644 --- a/components/script/dom/file.rs +++ b/components/script/dom/file.rs @@ -34,7 +34,7 @@ impl File { FileBinding::Wrap) } - pub fn name<'a>(&'a self) -> &'a DOMString { + pub fn name(&self) -> &DOMString { &self.name } } diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index 33a4a45d295..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<'a,'b>(other: &'a HTMLInputElement, - owner: Option<&'b 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 && diff --git a/components/script/dom/htmlmediaelement.rs b/components/script/dom/htmlmediaelement.rs index bef4dcd93e0..4b40e13e129 100644 --- a/components/script/dom/htmlmediaelement.rs +++ b/components/script/dom/htmlmediaelement.rs @@ -36,7 +36,7 @@ impl HTMLMediaElement { } #[inline] - pub fn htmlelement<'a>(&'a self) -> &'a HTMLElement { + pub fn htmlelement(&self) -> &HTMLElement { &self.htmlelement } } diff --git a/components/script/dom/keyboardevent.rs b/components/script/dom/keyboardevent.rs index 1aed28da355..1c8b6255aaa 100644 --- a/components/script/dom/keyboardevent.rs +++ b/components/script/dom/keyboardevent.rs @@ -155,7 +155,7 @@ impl KeyboardEvent { if self.meta.get() { result = result | constellation_msg::SUPER; } - return result; + result } } diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index 799b088a792..64e59cd4ee7 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -881,7 +881,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { } }, - _ => return self.webgl_error(InvalidEnum), + _ => self.webgl_error(InvalidEnum), } } @@ -899,7 +899,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { } }, - _ => return self.webgl_error(InvalidEnum), + _ => self.webgl_error(InvalidEnum), } } } diff --git a/components/script/dom/webgltexture.rs b/components/script/dom/webgltexture.rs index c549a6b7513..6bb91217bbd 100644 --- a/components/script/dom/webgltexture.rs +++ b/components/script/dom/webgltexture.rs @@ -107,10 +107,10 @@ impl WebGLTexture { self.renderer .send(CanvasMsg::WebGL(CanvasWebGLMsg::TexParameteri(target, name, int_value))) .unwrap(); - return Ok(()); + Ok(()) }, - _ => return Err(WebGLError::InvalidEnum), + _ => Err(WebGLError::InvalidEnum), } }, constants::TEXTURE_MAG_FILTER => { @@ -120,10 +120,10 @@ impl WebGLTexture { self.renderer .send(CanvasMsg::WebGL(CanvasWebGLMsg::TexParameteri(target, name, int_value))) .unwrap(); - return Ok(()); + Ok(()) }, - _ => return Err(WebGLError::InvalidEnum), + _ => Err(WebGLError::InvalidEnum), } }, constants::TEXTURE_WRAP_S | @@ -135,14 +135,14 @@ impl WebGLTexture { self.renderer .send(CanvasMsg::WebGL(CanvasWebGLMsg::TexParameteri(target, name, int_value))) .unwrap(); - return Ok(()); + Ok(()) }, - _ => return Err(WebGLError::InvalidEnum), + _ => Err(WebGLError::InvalidEnum), } }, - _ => return Err(WebGLError::InvalidEnum), + _ => Err(WebGLError::InvalidEnum), } } } diff --git a/components/script/script_task.rs b/components/script/script_task.rs index 6a77b92b213..7eb15d1e938 100644 --- a/components/script/script_task.rs +++ b/components/script/script_task.rs @@ -318,7 +318,7 @@ pub struct MainThreadScriptChan(pub Sender); impl ScriptChan for MainThreadScriptChan { fn send(&self, msg: CommonScriptMsg) -> Result<(), ()> { let MainThreadScriptChan(ref chan) = *self; - return chan.send(MainThreadScriptMsg::Common(msg)).map_err(|_| ()); + chan.send(MainThreadScriptMsg::Common(msg)).map_err(|_| ()) } fn clone(&self) -> Box { diff --git a/components/style/media_queries.rs b/components/style/media_queries.rs index bddfedb9c37..5c84c28ffed 100644 --- a/components/style/media_queries.rs +++ b/components/style/media_queries.rs @@ -217,8 +217,8 @@ impl MediaQueryList { // Check if all conditions match (AND condition) let query_match = media_match && mq.expressions.iter().all(|expression| { - match expression { - &Expression::Width(value) => + match *expression { + Expression::Width(ref value) => value.to_computed_range(viewport_size).evaluate(viewport_size.width), } }); diff --git a/components/style/properties.mako.rs b/components/style/properties.mako.rs index e9230819357..50781f36d76 100644 --- a/components/style/properties.mako.rs +++ b/components/style/properties.mako.rs @@ -477,9 +477,9 @@ pub mod longhands { impl ::cssparser::ToCss for T { fn to_css(&self, dest: &mut W) -> ::std::fmt::Result where W: ::std::fmt::Write { - match self { + match *self { % for value in values: - &T::${to_rust_ident(value)} => dest.write_str("${value}"), + T::${to_rust_ident(value)} => dest.write_str("${value}"), % endfor } } @@ -596,9 +596,9 @@ pub mod longhands { impl ToCss for T { fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { - match self { - &T::Auto => dest.write_str("auto"), - &T::Number(number) => write!(dest, "{}", number), + match *self { + T::Auto => dest.write_str("auto"), + T::Number(number) => write!(dest, "{}", number), } } } @@ -673,11 +673,11 @@ pub mod longhands { impl ToCss for SpecifiedValue { fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { - match self { - &SpecifiedValue::Normal => dest.write_str("normal"), - &SpecifiedValue::Length(length) => length.to_css(dest), - &SpecifiedValue::Number(number) => write!(dest, "{}", number), - &SpecifiedValue::Percentage(number) => write!(dest, "{}%", number * 100.), + match *self { + SpecifiedValue::Normal => dest.write_str("normal"), + SpecifiedValue::Length(length) => length.to_css(dest), + SpecifiedValue::Number(number) => write!(dest, "{}", number), + SpecifiedValue::Percentage(number) => write!(dest, "{}%", number * 100.), } } } @@ -714,10 +714,10 @@ pub mod longhands { } impl fmt::Debug for T { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - &T::Normal => write!(f, "normal"), - &T::Length(length) => write!(f, "{:?}%", length), - &T::Number(number) => write!(f, "{}", number), + match *self { + T::Normal => write!(f, "normal"), + T::Length(length) => write!(f, "{:?}%", length), + T::Number(number) => write!(f, "{}", number), } } } @@ -774,11 +774,11 @@ pub mod longhands { impl ToCss for SpecifiedValue { fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { - match self { + match *self { % for keyword in vertical_align_keywords: - &SpecifiedValue::${to_rust_ident(keyword)} => dest.write_str("${keyword}"), + SpecifiedValue::${to_rust_ident(keyword)} => dest.write_str("${keyword}"), % endfor - &SpecifiedValue::LengthOrPercentage(value) => value.to_css(dest), + SpecifiedValue::LengthOrPercentage(value) => value.to_css(dest), } } } @@ -817,13 +817,13 @@ pub mod longhands { } impl fmt::Debug for T { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { + match *self { % for keyword in vertical_align_keywords: - &T::${to_rust_ident(keyword)} => write!(f, "${keyword}"), + T::${to_rust_ident(keyword)} => write!(f, "${keyword}"), % endfor - &T::Length(length) => write!(f, "{:?}", length), - &T::Percentage(number) => write!(f, "{}%", number), - &T::Calc(calc) => write!(f, "{:?}", calc) + T::Length(length) => write!(f, "{:?}", length), + T::Percentage(number) => write!(f, "{}%", number), + T::Calc(calc) => write!(f, "{:?}", calc) } } } @@ -938,7 +938,7 @@ pub mod longhands { } pub fn parse(context: &ParserContext, input: &mut Parser) -> Result { - overflow_x::parse(context, input).map(|value| SpecifiedValue(value)) + overflow_x::parse(context, input).map(SpecifiedValue) } @@ -990,18 +990,18 @@ pub mod longhands { impl ToCss for ContentItem { fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { - match self { - &ContentItem::String(ref s) => { + match *self { + ContentItem::String(ref s) => { cssparser::serialize_string(&**s, dest) } - &ContentItem::Counter(ref s, ref list_style_type) => { + ContentItem::Counter(ref s, ref list_style_type) => { try!(dest.write_str("counter(")); try!(cssparser::serialize_identifier(&**s, dest)); try!(dest.write_str(", ")); try!(list_style_type.to_css(dest)); dest.write_str(")") } - &ContentItem::Counters(ref s, ref separator, ref list_style_type) => { + ContentItem::Counters(ref s, ref separator, ref list_style_type) => { try!(dest.write_str("counter(")); try!(cssparser::serialize_identifier(&**s, dest)); try!(dest.write_str(", ")); @@ -1010,10 +1010,10 @@ pub mod longhands { try!(list_style_type.to_css(dest)); dest.write_str(")") } - &ContentItem::OpenQuote => dest.write_str("open-quote"), - &ContentItem::CloseQuote => dest.write_str("close-quote"), - &ContentItem::NoOpenQuote => dest.write_str("no-open-quote"), - &ContentItem::NoCloseQuote => dest.write_str("no-close-quote"), + ContentItem::OpenQuote => dest.write_str("open-quote"), + ContentItem::CloseQuote => dest.write_str("close-quote"), + ContentItem::NoOpenQuote => dest.write_str("no-open-quote"), + ContentItem::NoCloseQuote => dest.write_str("no-close-quote"), } } } @@ -1028,10 +1028,10 @@ pub mod longhands { impl ToCss for T { fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { - match self { - &T::normal => dest.write_str("normal"), - &T::none => dest.write_str("none"), - &T::Content(ref content) => { + match *self { + T::normal => dest.write_str("normal"), + T::none => dest.write_str("none"), + T::Content(ref content) => { let mut iter = content.iter(); try!(iter.next().unwrap().to_css(dest)); for c in iter { @@ -1737,8 +1737,8 @@ pub mod longhands { } impl ToCss for FontFamily { fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { - match self { - &FontFamily::FamilyName(ref name) => dest.write_str(name.as_slice()), + match *self { + FontFamily::FamilyName(ref name) => dest.write_str(name.as_slice()), } } } @@ -1809,11 +1809,11 @@ pub mod longhands { impl ToCss for SpecifiedValue { fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { - match self { - &SpecifiedValue::Bolder => dest.write_str("bolder"), - &SpecifiedValue::Lighter => dest.write_str("lighter"), + match *self { + SpecifiedValue::Bolder => dest.write_str("bolder"), + SpecifiedValue::Lighter => dest.write_str("lighter"), % for weight in range(100, 901, 100): - &SpecifiedValue::Weight${weight} => dest.write_str("${weight}"), + SpecifiedValue::Weight${weight} => dest.write_str("${weight}"), % endfor } } @@ -1853,9 +1853,9 @@ pub mod longhands { } impl fmt::Debug for T { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { + match *self { % for weight in range(100, 901, 100): - &T::Weight${weight} => write!(f, "{}", ${weight}), + T::Weight${weight} => write!(f, "{}", ${weight}), % endfor } } @@ -3271,9 +3271,7 @@ pub mod longhands { if input.try(|input| input.expect_ident_matching("none")).is_ok() { Ok(SpecifiedValue(Vec::new())) } else { - input.parse_comma_separated(parse_one_text_shadow).map(|shadows| { - SpecifiedValue(shadows) - }) + input.parse_comma_separated(parse_one_text_shadow).map(SpecifiedValue) } } @@ -3561,17 +3559,17 @@ pub mod longhands { fn to_computed_value(&self, context: &computed::Context) -> computed_value::T { computed_value::T{ filters: self.0.iter().map(|value| { - match value { - &SpecifiedFilter::Blur(factor) => + match *value { + SpecifiedFilter::Blur(factor) => computed_value::Filter::Blur(factor.to_computed_value(context)), - &SpecifiedFilter::Brightness(factor) => computed_value::Filter::Brightness(factor), - &SpecifiedFilter::Contrast(factor) => computed_value::Filter::Contrast(factor), - &SpecifiedFilter::Grayscale(factor) => computed_value::Filter::Grayscale(factor), - &SpecifiedFilter::HueRotate(factor) => computed_value::Filter::HueRotate(factor), - &SpecifiedFilter::Invert(factor) => computed_value::Filter::Invert(factor), - &SpecifiedFilter::Opacity(factor) => computed_value::Filter::Opacity(factor), - &SpecifiedFilter::Saturate(factor) => computed_value::Filter::Saturate(factor), - &SpecifiedFilter::Sepia(factor) => computed_value::Filter::Sepia(factor), + SpecifiedFilter::Brightness(factor) => computed_value::Filter::Brightness(factor), + SpecifiedFilter::Contrast(factor) => computed_value::Filter::Contrast(factor), + SpecifiedFilter::Grayscale(factor) => computed_value::Filter::Grayscale(factor), + SpecifiedFilter::HueRotate(factor) => computed_value::Filter::HueRotate(factor), + SpecifiedFilter::Invert(factor) => computed_value::Filter::Invert(factor), + SpecifiedFilter::Opacity(factor) => computed_value::Filter::Opacity(factor), + SpecifiedFilter::Saturate(factor) => computed_value::Filter::Saturate(factor), + SpecifiedFilter::Sepia(factor) => computed_value::Filter::Sepia(factor), } }).collect() } } @@ -5713,11 +5711,11 @@ pub enum DeclaredValue { impl DeclaredValue { pub fn specified_value(&self) -> String { - match self { - &DeclaredValue::Value(ref inner) => inner.to_css_string(), - &DeclaredValue::WithVariables { ref css, .. } => css.clone(), - &DeclaredValue::Initial => "initial".to_owned(), - &DeclaredValue::Inherit => "inherit".to_owned(), + match *self { + DeclaredValue::Value(ref inner) => inner.to_css_string(), + DeclaredValue::WithVariables { ref css, .. } => css.clone(), + DeclaredValue::Initial => "initial".to_owned(), + DeclaredValue::Inherit => "inherit".to_owned(), } } } @@ -5741,10 +5739,10 @@ pub enum PropertyDeclarationParseResult { impl PropertyDeclaration { pub fn name(&self) -> &'static str { - match self { + match *self { % for property in LONGHANDS: % if property.derived_from is None: - &PropertyDeclaration::${property.camel_case}(..) => "${property.name}", + PropertyDeclaration::${property.camel_case}(..) => "${property.name}", % endif % endfor _ => "", @@ -5752,14 +5750,14 @@ impl PropertyDeclaration { } pub fn value(&self) -> String { - match self { + match *self { % for property in LONGHANDS: % if property.derived_from is None: - &PropertyDeclaration::${property.camel_case}(ref value) => + PropertyDeclaration::${property.camel_case}(ref value) => value.specified_value(), % endif % endfor - decl => panic!("unsupported property declaration: {:?}", decl.name()), + ref decl => panic!("unsupported property declaration: {:?}", decl.name()), } }