diff --git a/components/canvas/canvas_data.rs b/components/canvas/canvas_data.rs index 96e2c08f141..c857b763838 100644 --- a/components/canvas/canvas_data.rs +++ b/components/canvas/canvas_data.rs @@ -136,7 +136,7 @@ struct PathBuilderRef<'a> { transform: Transform2D, } -impl<'a> PathBuilderRef<'a> { +impl PathBuilderRef<'_> { fn line_to(&mut self, pt: &Point2D) { let pt = self.transform.transform_point(*pt); self.builder.line_to(pt); @@ -238,7 +238,7 @@ struct UnshapedTextRun<'a> { string: &'a str, } -impl<'a> UnshapedTextRun<'a> { +impl UnshapedTextRun<'_> { fn script_and_font_compatible(&self, script: Script, other_font: &Option) -> bool { if self.script != script { return false; @@ -1417,7 +1417,7 @@ impl<'a> CanvasData<'a> { } } -impl<'a> Drop for CanvasData<'a> { +impl Drop for CanvasData<'_> { fn drop(&mut self) { let mut updates = vec![]; if let Some(image_key) = self.old_image_key.take() { diff --git a/components/canvas/lib.rs b/components/canvas/lib.rs index 74982150356..d2c62c1d8b6 100644 --- a/components/canvas/lib.rs +++ b/components/canvas/lib.rs @@ -3,7 +3,6 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ #![deny(unsafe_code)] -#![allow(clippy::needless_lifetimes)] mod raqote_backend; diff --git a/components/canvas/raqote_backend.rs b/components/canvas/raqote_backend.rs index e7e3d116b5f..432bfe82aa8 100644 --- a/components/canvas/raqote_backend.rs +++ b/components/canvas/raqote_backend.rs @@ -118,7 +118,7 @@ pub enum Pattern<'a> { Surface(SurfacePattern<'a>), } -impl<'a> Pattern<'a> { +impl Pattern<'_> { fn set_transform(&mut self, transform: Transform2D) { match self { Pattern::Surface(pattern) => pattern.set_transform(transform), diff --git a/components/canvas/webgl_limits.rs b/components/canvas/webgl_limits.rs index 17f08fb94c2..f683b6efff6 100644 --- a/components/canvas/webgl_limits.rs +++ b/components/canvas/webgl_limits.rs @@ -233,7 +233,7 @@ macro_rules! create_fun { }; } -impl<'a> GLExt for &'a Gl { +impl GLExt for &Gl { create_fun!( try_get_integer, get_integer, diff --git a/components/canvas/webxr.rs b/components/canvas/webxr.rs index ce764fcf653..791e1394061 100644 --- a/components/canvas/webxr.rs +++ b/components/canvas/webxr.rs @@ -310,7 +310,7 @@ pub(crate) struct WebXRBridgeContexts<'a> { pub(crate) bound_context_id: &'a mut Option, } -impl<'a> WebXRContexts for WebXRBridgeContexts<'a> { +impl WebXRContexts for WebXRBridgeContexts<'_> { fn context(&mut self, device: &Device, context_id: WebXRContextId) -> Option<&mut Context> { let data = WebGLThread::make_current_if_needed_mut( device, diff --git a/components/hyper_serde/lib.rs b/components/hyper_serde/lib.rs index 3793fa0ce3e..663faab8904 100644 --- a/components/hyper_serde/lib.rs +++ b/components/hyper_serde/lib.rs @@ -62,7 +62,6 @@ #![deny(missing_docs)] #![deny(unsafe_code)] -#![allow(clippy::needless_lifetimes)] use std::ops::{Deref, DerefMut}; use std::str::FromStr; @@ -288,7 +287,7 @@ impl<'de> Deserialize<'de> for De { } } -impl<'a> Serialize for Ser<'a, ContentType> { +impl Serialize for Ser<'_, ContentType> { fn serialize(&self, serializer: S) -> Result where S: Serializer, @@ -304,7 +303,7 @@ impl<'de> Deserialize<'de> for De> { { struct CookieVisitor; - impl<'de> Visitor<'de> for CookieVisitor { + impl Visitor<'_> for CookieVisitor { type Value = De>; fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { @@ -326,7 +325,7 @@ impl<'de> Deserialize<'de> for De> { } } -impl<'a, 'cookie> Serialize for Ser<'a, Cookie<'cookie>> { +impl Serialize for Ser<'_, Cookie<'_>> { fn serialize(&self, serializer: S) -> Result where S: Serializer, @@ -418,14 +417,14 @@ impl<'de> Deserialize<'de> for De { } } -impl<'a> Serialize for Ser<'a, HeaderMap> { +impl Serialize for Ser<'_, HeaderMap> { fn serialize(&self, serializer: S) -> Result where S: Serializer, { struct Value<'headers>(&'headers [Vec], bool); - impl<'headers> Serialize for Value<'headers> { + impl Serialize for Value<'_> { fn serialize(&self, serializer: S) -> Result where S: Serializer, @@ -469,7 +468,7 @@ impl<'de> Deserialize<'de> for De { { struct MethodVisitor; - impl<'de> Visitor<'de> for MethodVisitor { + impl Visitor<'_> for MethodVisitor { type Value = De; fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { @@ -488,7 +487,7 @@ impl<'de> Deserialize<'de> for De { } } -impl<'a> Serialize for Ser<'a, Method> { +impl Serialize for Ser<'_, Method> { fn serialize(&self, serializer: S) -> Result where S: Serializer, @@ -504,7 +503,7 @@ impl<'de> Deserialize<'de> for De { { struct MimeVisitor; - impl<'de> Visitor<'de> for MimeVisitor { + impl Visitor<'_> for MimeVisitor { type Value = De; fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { @@ -525,7 +524,7 @@ impl<'de> Deserialize<'de> for De { } } -impl<'a> Serialize for Ser<'a, Mime> { +impl Serialize for Ser<'_, Mime> { fn serialize(&self, serializer: S) -> Result where S: Serializer, @@ -546,7 +545,7 @@ impl<'de> Deserialize<'de> for De { } } -impl<'a> Serialize for Ser<'a, StatusCode> { +impl Serialize for Ser<'_, StatusCode> { fn serialize(&self, serializer: S) -> Result where S: Serializer, @@ -555,7 +554,7 @@ impl<'a> Serialize for Ser<'a, StatusCode> { } } -impl<'a> Serialize for Ser<'a, (StatusCode, String)> { +impl Serialize for Ser<'_, (StatusCode, String)> { fn serialize(&self, serializer: S) -> Result where S: Serializer, @@ -610,7 +609,7 @@ impl<'de> Deserialize<'de> for De { { struct UriVisitor; - impl<'de> Visitor<'de> for UriVisitor { + impl Visitor<'_> for UriVisitor { type Value = De; fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { @@ -631,7 +630,7 @@ impl<'de> Deserialize<'de> for De { } } -impl<'a> Serialize for Ser<'a, Uri> { +impl Serialize for Ser<'_, Uri> { fn serialize(&self, serializer: S) -> Result where S: Serializer, diff --git a/components/layout/block.rs b/components/layout/block.rs index 003ea4bcaa5..43817cbbc25 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -529,7 +529,7 @@ fn translate_including_floats(cur_b: &mut Au, delta: Au, floats: &mut Floats) { /// have the Root flow as their CB. pub struct AbsoluteAssignBSizesTraversal<'a>(pub &'a SharedStyleContext<'a>); -impl<'a> PreorderFlowTraversal for AbsoluteAssignBSizesTraversal<'a> { +impl PreorderFlowTraversal for AbsoluteAssignBSizesTraversal<'_> { #[inline] fn process(&self, flow: &mut dyn Flow) { if !flow.is_block_like() { diff --git a/components/layout/construct.rs b/components/layout/construct.rs index 1a864e45e64..7761a9482e4 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -1802,9 +1802,9 @@ where } } -impl<'a, 'dom, ConcreteThreadSafeLayoutNode> +impl<'dom, ConcreteThreadSafeLayoutNode> PostorderNodeMutTraversal<'dom, ConcreteThreadSafeLayoutNode> - for FlowConstructor<'a, ConcreteThreadSafeLayoutNode> + for FlowConstructor<'_, ConcreteThreadSafeLayoutNode> where ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode<'dom>, { diff --git a/components/layout/context.rs b/components/layout/context.rs index 8272dbd1d18..39b3f2b88aa 100644 --- a/components/layout/context.rs +++ b/components/layout/context.rs @@ -54,7 +54,7 @@ pub struct LayoutContext<'a> { pub pending_images: Mutex>, } -impl<'a> Drop for LayoutContext<'a> { +impl Drop for LayoutContext<'_> { fn drop(&mut self) { if !thread::panicking() { assert!(self.pending_images.lock().unwrap().is_empty()); @@ -62,7 +62,7 @@ impl<'a> Drop for LayoutContext<'a> { } } -impl<'a> LayoutContext<'a> { +impl LayoutContext<'_> { #[inline(always)] pub fn shared_context(&self) -> &SharedStyleContext { &self.style_context diff --git a/components/layout/flow.rs b/components/layout/flow.rs index 9704248082b..b5140f8e8e7 100644 --- a/components/layout/flow.rs +++ b/components/layout/flow.rs @@ -1231,7 +1231,7 @@ impl BaseFlow { } } -impl<'a> ImmutableFlowUtils for &'a dyn Flow { +impl ImmutableFlowUtils for &dyn Flow { /// Returns true if this flow is a block flow or subclass thereof. fn is_block_like(self) -> bool { self.class().is_block_like() @@ -1332,7 +1332,7 @@ impl<'a> ImmutableFlowUtils for &'a dyn Flow { } } -impl<'a> MutableFlowUtils for &'a mut dyn Flow { +impl MutableFlowUtils for &mut dyn Flow { /// Calls `repair_style` and `bubble_inline_sizes`. You should use this method instead of /// calling them individually, since there is no reason not to perform both operations. fn repair_style_and_bubble_inline_sizes(self, style: &crate::ServoArc) { diff --git a/components/layout/flow_list.rs b/components/layout/flow_list.rs index 1fc33b2e246..eceed09028c 100644 --- a/components/layout/flow_list.rs +++ b/components/layout/flow_list.rs @@ -192,7 +192,7 @@ pub struct FlowListRandomAccessMut<'a> { cache: Vec, } -impl<'a> FlowListRandomAccessMut<'a> { +impl FlowListRandomAccessMut<'_> { pub fn get(&mut self, index: usize) -> &mut dyn Flow { while index >= self.cache.len() { match self.iterator.next() { diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs index 6a94f4d374c..e750f08d61d 100644 --- a/components/layout/fragment.rs +++ b/components/layout/fragment.rs @@ -3353,7 +3353,7 @@ impl<'a> Iterator for InlineStyleIterator<'a> { } } -impl<'a> InlineStyleIterator<'a> { +impl InlineStyleIterator<'_> { fn new(fragment: &Fragment) -> InlineStyleIterator { InlineStyleIterator { fragment, diff --git a/components/layout/generated_content.rs b/components/layout/generated_content.rs index 9cadcbc8aa6..13c55efc8a7 100644 --- a/components/layout/generated_content.rs +++ b/components/layout/generated_content.rs @@ -133,7 +133,7 @@ impl<'a> ResolveGeneratedContent<'a> { } } -impl<'a> InorderFlowTraversal for ResolveGeneratedContent<'a> { +impl InorderFlowTraversal for ResolveGeneratedContent<'_> { #[inline] fn process(&mut self, flow: &mut dyn Flow, level: u32) { let mut mutator = ResolveGeneratedContentFragmentMutator { @@ -168,7 +168,7 @@ struct ResolveGeneratedContentFragmentMutator<'a, 'b: 'a> { incremented: bool, } -impl<'a, 'b> ResolveGeneratedContentFragmentMutator<'a, 'b> { +impl ResolveGeneratedContentFragmentMutator<'_, '_> { fn mutate_fragment(&mut self, fragment: &mut Fragment) { // We only reset and/or increment counters once per flow. This avoids double-incrementing // counters on list items (once for the main fragment and once for the marker). diff --git a/components/layout/table.rs b/components/layout/table.rs index 3f652d71051..859d3c47516 100644 --- a/components/layout/table.rs +++ b/components/layout/table.rs @@ -1317,7 +1317,7 @@ impl<'table> Iterator for TableCellStyleIterator<'table> { } } -impl<'table> TableCellStyleInfo<'table> { +impl TableCellStyleInfo<'_> { fn build_display_list(&self, mut state: &mut DisplayListBuildState) { use style::computed_values::visibility::T as Visibility; diff --git a/components/layout/table_wrapper.rs b/components/layout/table_wrapper.rs index 3072b8f8573..21313e47c4e 100644 --- a/components/layout/table_wrapper.rs +++ b/components/layout/table_wrapper.rs @@ -669,7 +669,7 @@ impl AutoLayoutCandidateGuess { } } -impl<'a> Add for &'a AutoLayoutCandidateGuess { +impl Add for &AutoLayoutCandidateGuess { type Output = AutoLayoutCandidateGuess; #[inline] fn add(self, other: &AutoLayoutCandidateGuess) -> AutoLayoutCandidateGuess { diff --git a/components/layout/text_run.rs b/components/layout/text_run.rs index 9bddc5078b8..930fd980d5b 100644 --- a/components/layout/text_run.rs +++ b/components/layout/text_run.rs @@ -69,7 +69,7 @@ pub struct TextRunSlice<'a> { pub range: Range, } -impl<'a> TextRunSlice<'a> { +impl TextRunSlice<'_> { /// Returns the range that these glyphs encompass, relative to the start of the *text run*. #[inline] pub fn text_run_range(&self) -> Range { diff --git a/components/layout/traversal.rs b/components/layout/traversal.rs index 8040d0e1427..0d33c02e068 100644 --- a/components/layout/traversal.rs +++ b/components/layout/traversal.rs @@ -43,7 +43,7 @@ impl<'a> RecalcStyleAndConstructFlows<'a> { } #[allow(unsafe_code)] -impl<'a, 'dom, E> DomTraversal for RecalcStyleAndConstructFlows<'a> +impl<'dom, E> DomTraversal for RecalcStyleAndConstructFlows<'_> where E: TElement, E::ConcreteNode: LayoutNode<'dom>, @@ -252,7 +252,7 @@ pub struct BubbleISizes<'a> { pub layout_context: &'a LayoutContext<'a>, } -impl<'a> PostorderFlowTraversal for BubbleISizes<'a> { +impl PostorderFlowTraversal for BubbleISizes<'_> { #[inline] fn process(&self, flow: &mut dyn Flow) { flow.bubble_inline_sizes(); @@ -275,7 +275,7 @@ pub struct AssignISizes<'a> { pub layout_context: &'a LayoutContext<'a>, } -impl<'a> PreorderFlowTraversal for AssignISizes<'a> { +impl PreorderFlowTraversal for AssignISizes<'_> { #[inline] fn process(&self, flow: &mut dyn Flow) { flow.assign_inline_sizes(self.layout_context); @@ -297,7 +297,7 @@ pub struct AssignBSizes<'a> { pub layout_context: &'a LayoutContext<'a>, } -impl<'a> PostorderFlowTraversal for AssignBSizes<'a> { +impl PostorderFlowTraversal for AssignBSizes<'_> { #[inline] fn process(&self, flow: &mut dyn Flow) { // Can't do anything with anything that floats might flow through until we reach their @@ -326,7 +326,7 @@ pub struct ComputeStackingRelativePositions<'a> { pub layout_context: &'a LayoutContext<'a>, } -impl<'a> PreorderFlowTraversal for ComputeStackingRelativePositions<'a> { +impl PreorderFlowTraversal for ComputeStackingRelativePositions<'_> { #[inline] fn should_process_subtree(&self, flow: &mut dyn Flow) -> bool { flow.base() @@ -347,7 +347,7 @@ pub struct BuildDisplayList<'a> { pub state: DisplayListBuildState<'a>, } -impl<'a> BuildDisplayList<'a> { +impl BuildDisplayList<'_> { #[inline] pub fn traverse(&mut self, flow: &mut dyn Flow) { if flow.has_non_invertible_transform_or_zero_scale() { diff --git a/components/layout_2020/construct_modern.rs b/components/layout_2020/construct_modern.rs index 713954a39c8..96fa29b9c96 100644 --- a/components/layout_2020/construct_modern.rs +++ b/components/layout_2020/construct_modern.rs @@ -71,7 +71,7 @@ pub(crate) struct ModernItem<'dom> { pub formatting_context: IndependentFormattingContext, } -impl<'a, 'dom, Node: 'dom> TraversalHandler<'dom, Node> for ModernContainerBuilder<'a, 'dom, Node> +impl<'dom, Node: 'dom> TraversalHandler<'dom, Node> for ModernContainerBuilder<'_, 'dom, Node> where Node: NodeExt<'dom>, { diff --git a/components/layout_2020/context.rs b/components/layout_2020/context.rs index 871fce6cb0d..ad3d3ade32a 100644 --- a/components/layout_2020/context.rs +++ b/components/layout_2020/context.rs @@ -42,7 +42,7 @@ pub struct LayoutContext<'a> { Arc>>, } -impl<'a> Drop for LayoutContext<'a> { +impl Drop for LayoutContext<'_> { fn drop(&mut self) { if !std::thread::panicking() { assert!(self.pending_images.lock().is_empty()); @@ -50,7 +50,7 @@ impl<'a> Drop for LayoutContext<'a> { } } -impl<'a> LayoutContext<'a> { +impl LayoutContext<'_> { #[inline(always)] pub fn shared_context(&self) -> &SharedStyleContext { &self.style_context diff --git a/components/layout_2020/display_list/mod.rs b/components/layout_2020/display_list/mod.rs index 2be4d005e30..ed568562351 100644 --- a/components/layout_2020/display_list/mod.rs +++ b/components/layout_2020/display_list/mod.rs @@ -189,7 +189,7 @@ impl DisplayList { } } -impl<'a> DisplayListBuilder<'a> { +impl DisplayListBuilder<'_> { fn wr(&mut self) -> &mut wr::DisplayListBuilder { &mut self.display_list.wr } diff --git a/components/layout_2020/flexbox/layout.rs b/components/layout_2020/flexbox/layout.rs index 84cc08232fc..a70e676cbf5 100644 --- a/components/layout_2020/flexbox/layout.rs +++ b/components/layout_2020/flexbox/layout.rs @@ -176,7 +176,7 @@ struct FlexLineItem<'a> { used_main_size: Au, } -impl<'a> FlexLineItem<'a> { +impl FlexLineItem<'_> { fn get_or_synthesize_baseline_with_cross_size(&self, cross_size: Au) -> Au { self.layout_result .baseline_relative_to_margin_box diff --git a/components/layout_2020/flow/inline/line.rs b/components/layout_2020/flow/inline/line.rs index ed86cf54a54..f67efc14f05 100644 --- a/components/layout_2020/flow/inline/line.rs +++ b/components/layout_2020/flow/inline/line.rs @@ -152,7 +152,7 @@ pub(super) struct LineItemLayout<'layout_data, 'layout> { pub justification_adjustment: Au, } -impl<'layout_data, 'layout> LineItemLayout<'layout_data, 'layout> { +impl LineItemLayout<'_, '_> { pub(super) fn layout_line_items( layout: &mut InlineFormattingContextLayout, line_items: Vec, diff --git a/components/layout_2020/flow/inline/mod.rs b/components/layout_2020/flow/inline/mod.rs index 3b4e5a02820..1af7841c234 100644 --- a/components/layout_2020/flow/inline/mod.rs +++ b/components/layout_2020/flow/inline/mod.rs @@ -649,7 +649,7 @@ pub(super) struct InlineFormattingContextLayout<'layout_data> { baselines: Baselines, } -impl<'layout_dta> InlineFormattingContextLayout<'layout_dta> { +impl InlineFormattingContextLayout<'_> { fn current_inline_container_state(&self) -> &InlineContainerState { match self.inline_box_state_stack.last() { Some(inline_box_state) => &inline_box_state.base, diff --git a/components/layout_2020/lib.rs b/components/layout_2020/lib.rs index bf38def9e28..1a84b6c94b4 100644 --- a/components/layout_2020/lib.rs +++ b/components/layout_2020/lib.rs @@ -3,7 +3,6 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ #![deny(unsafe_code)] -#![allow(clippy::needless_lifetimes)] mod cell; pub mod context; diff --git a/components/layout_2020/positioned.rs b/components/layout_2020/positioned.rs index 0b1ba1e02e6..fb74e417cc4 100644 --- a/components/layout_2020/positioned.rs +++ b/components/layout_2020/positioned.rs @@ -749,7 +749,7 @@ struct AbsoluteAxisSolver<'a> { flip_anchor: bool, } -impl<'a> AbsoluteAxisSolver<'a> { +impl AbsoluteAxisSolver<'_> { /// Returns the amount that we need to subtract from the containing block size in order to /// obtain the inset-modified containing block that we will use for sizing purposes. /// (Note that for alignment purposes, we may re-resolve auto insets to a different value.) diff --git a/components/layout_2020/table/construct.rs b/components/layout_2020/table/construct.rs index 8f9b5a484d8..9196675530a 100644 --- a/components/layout_2020/table/construct.rs +++ b/components/layout_2020/table/construct.rs @@ -39,7 +39,7 @@ pub(super) struct ResolvedSlotAndLocation<'a> { pub coords: TableSlotCoordinates, } -impl<'a> ResolvedSlotAndLocation<'a> { +impl ResolvedSlotAndLocation<'_> { fn covers_cell_at(&self, coords: TableSlotCoordinates) -> bool { let covered_in_x = coords.x >= self.coords.x && coords.x < self.coords.x + self.cell.colspan; @@ -59,7 +59,7 @@ pub(crate) enum AnonymousTableContent<'dom, Node> { }, } -impl<'dom, Node> AnonymousTableContent<'dom, Node> { +impl AnonymousTableContent<'_, Node> { fn is_whitespace_only(&self) -> bool { match self { Self::Element { .. } => false, @@ -725,8 +725,7 @@ where } } -impl<'style, 'dom, Node: 'dom> TraversalHandler<'dom, Node> - for TableBuilderTraversal<'style, 'dom, Node> +impl<'dom, Node: 'dom> TraversalHandler<'dom, Node> for TableBuilderTraversal<'_, 'dom, Node> where Node: NodeExt<'dom>, { @@ -987,8 +986,7 @@ where } } -impl<'style, 'builder, 'dom, 'a, Node: 'dom> TraversalHandler<'dom, Node> - for TableRowBuilder<'style, 'builder, 'dom, 'a, Node> +impl<'dom, Node: 'dom> TraversalHandler<'dom, Node> for TableRowBuilder<'_, '_, 'dom, '_, Node> where Node: NodeExt<'dom>, { diff --git a/components/layout_2020/table/layout.rs b/components/layout_2020/table/layout.rs index aed912cc412..32739905f5a 100644 --- a/components/layout_2020/table/layout.rs +++ b/components/layout_2020/table/layout.rs @@ -2922,7 +2922,7 @@ struct RowspanToDistribute<'a> { measure: &'a CellOrTrackMeasure, } -impl<'a> RowspanToDistribute<'a> { +impl RowspanToDistribute<'_> { fn range(&self) -> Range { self.coordinates.y..self.coordinates.y + self.cell.rowspan } diff --git a/components/layout_2020/traversal.rs b/components/layout_2020/traversal.rs index d1e4b8b65ef..0ce4cbae418 100644 --- a/components/layout_2020/traversal.rs +++ b/components/layout_2020/traversal.rs @@ -30,7 +30,7 @@ impl<'a> RecalcStyle<'a> { } #[allow(unsafe_code)] -impl<'a, 'dom, E> DomTraversal for RecalcStyle<'a> +impl<'dom, E> DomTraversal for RecalcStyle<'_> where E: TElement, E::ConcreteNode: 'dom + LayoutNode<'dom>, diff --git a/components/script/document_collection.rs b/components/script/document_collection.rs index 778fef202ac..bcff897910e 100644 --- a/components/script/document_collection.rs +++ b/components/script/document_collection.rs @@ -105,7 +105,7 @@ pub struct DocumentsIter<'a> { iter: hash_map::Iter<'a, PipelineId, Dom>, } -impl<'a> Iterator for DocumentsIter<'a> { +impl Iterator for DocumentsIter<'_> { type Item = (PipelineId, DomRoot); fn next(&mut self) -> Option<(PipelineId, DomRoot)> { diff --git a/components/script/dom/audiocontext.rs b/components/script/dom/audiocontext.rs index 544b8bb474a..a42809caae8 100644 --- a/components/script/dom/audiocontext.rs +++ b/components/script/dom/audiocontext.rs @@ -315,7 +315,7 @@ impl Convert for AudioContextLatencyCategory { } } -impl<'a> Convert for &'a AudioContextOptions { +impl Convert for &AudioContextOptions { fn convert(self) -> RealTimeAudioContextOptions { RealTimeAudioContextOptions { sample_rate: *self.sampleRate.unwrap_or(Finite::wrap(44100.)), diff --git a/components/script/dom/bindings/callback.rs b/components/script/dom/bindings/callback.rs index 5f1ec6d1c07..b59db051de5 100644 --- a/components/script/dom/bindings/callback.rs +++ b/components/script/dom/bindings/callback.rs @@ -216,7 +216,7 @@ impl ThisReflector for T { } } -impl<'a> ThisReflector for HandleObject<'a> { +impl ThisReflector for HandleObject<'_> { fn jsobject(&self) -> *mut JSObject { self.get() } diff --git a/components/script/dom/bindings/root.rs b/components/script/dom/bindings/root.rs index 814ba48f593..6ca8a5f9cee 100644 --- a/components/script/dom/bindings/root.rs +++ b/components/script/dom/bindings/root.rs @@ -260,7 +260,7 @@ impl<'a> ThreadLocalStackRoots<'a> { } } -impl<'a> Drop for ThreadLocalStackRoots<'a> { +impl Drop for ThreadLocalStackRoots<'_> { fn drop(&mut self) { STACK_ROOTS.with(|r| r.set(None)); } @@ -698,7 +698,7 @@ impl PartialEq for MutNullableDom { } } -impl<'a, T: DomObject> PartialEq> for MutNullableDom { +impl PartialEq> for MutNullableDom { fn eq(&self, other: &Option<&T>) -> bool { unsafe { *self.ptr.get() == other.map(Dom::from_ref) } } diff --git a/components/script/dom/bindings/str.rs b/components/script/dom/bindings/str.rs index 40d481cfed6..44e8466adda 100644 --- a/components/script/dom/bindings/str.rs +++ b/components/script/dom/bindings/str.rs @@ -356,7 +356,7 @@ impl From for DOMString { } } -impl<'a> From<&'a str> for DOMString { +impl From<&str> for DOMString { fn from(contents: &str) -> DOMString { DOMString::from(String::from(contents)) } diff --git a/components/script/dom/biquadfilternode.rs b/components/script/dom/biquadfilternode.rs index 4c319462ad6..4734e2921fa 100644 --- a/components/script/dom/biquadfilternode.rs +++ b/components/script/dom/biquadfilternode.rs @@ -187,7 +187,7 @@ impl BiquadFilterNodeMethods for BiquadFilterNode { } } -impl<'a> Convert for &'a BiquadFilterOptions { +impl Convert for &BiquadFilterOptions { fn convert(self) -> BiquadFilterNodeOptions { BiquadFilterNodeOptions { gain: *self.gain, diff --git a/components/script/dom/canvasgradient.rs b/components/script/dom/canvasgradient.rs index 51bdf30ad79..2d7d1789026 100644 --- a/components/script/dom/canvasgradient.rs +++ b/components/script/dom/canvasgradient.rs @@ -75,7 +75,7 @@ pub trait ToFillOrStrokeStyle { fn to_fill_or_stroke_style(self) -> FillOrStrokeStyle; } -impl<'a> ToFillOrStrokeStyle for &'a CanvasGradient { +impl ToFillOrStrokeStyle for &CanvasGradient { fn to_fill_or_stroke_style(self) -> FillOrStrokeStyle { let gradient_stops = self.stops.borrow().clone(); match self.style { diff --git a/components/script/dom/canvaspattern.rs b/components/script/dom/canvaspattern.rs index 6224500ca4a..238c561e880 100644 --- a/components/script/dom/canvaspattern.rs +++ b/components/script/dom/canvaspattern.rs @@ -70,7 +70,7 @@ impl CanvasPattern { } } -impl<'a> ToFillOrStrokeStyle for &'a CanvasPattern { +impl ToFillOrStrokeStyle for &CanvasPattern { fn to_fill_or_stroke_style(self) -> FillOrStrokeStyle { FillOrStrokeStyle::Surface(SurfaceStyle::new( self.surface_data.clone(), diff --git a/components/script/dom/dedicatedworkerglobalscope.rs b/components/script/dom/dedicatedworkerglobalscope.rs index 6cdae855dba..45684477b84 100644 --- a/components/script/dom/dedicatedworkerglobalscope.rs +++ b/components/script/dom/dedicatedworkerglobalscope.rs @@ -83,7 +83,7 @@ impl<'a> AutoWorkerReset<'a> { } } -impl<'a> Drop for AutoWorkerReset<'a> { +impl Drop for AutoWorkerReset<'_> { fn drop(&mut self) { self.workerscope .worker diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index b84e6739f9e..b7c2949660f 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -681,7 +681,7 @@ pub trait LayoutElementHelpers<'dom> { fn get_attr_vals_for_layout(self, name: &LocalName) -> Vec<&'dom AttrValue>; } -impl<'dom> LayoutDom<'dom, Element> { +impl LayoutDom<'_, Element> { pub(super) fn focus_state(self) -> bool { self.unsafe_get().state.get().contains(ElementState::FOCUS) } @@ -4361,7 +4361,7 @@ pub enum AttributeMutation<'a> { Removed, } -impl<'a> AttributeMutation<'a> { +impl AttributeMutation<'_> { pub fn is_removal(&self) -> bool { match *self { AttributeMutation::Removed => true, diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs index f5dbe6cd299..e3271211190 100644 --- a/components/script/dom/htmlformelement.rs +++ b/components/script/dom/htmlformelement.rs @@ -1383,7 +1383,7 @@ pub enum FormSubmitterElement<'a> { // (including custom elements) that can be passed as submitter. } -impl<'a> FormSubmitterElement<'a> { +impl FormSubmitterElement<'_> { fn action(&self) -> DOMString { match *self { FormSubmitterElement::Form(form) => form.Action(), diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index b2aaba04517..1a8eb3c6c06 100644 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -195,7 +195,7 @@ impl InputType { } } -impl<'a> From<&'a Atom> for InputType { +impl From<&Atom> for InputType { fn from(value: &Atom) -> InputType { match value.to_ascii_lowercase() { atom!("button") => InputType::Button, diff --git a/components/script/dom/htmlobjectelement.rs b/components/script/dom/htmlobjectelement.rs index 591a330ad40..32bf6aae815 100644 --- a/components/script/dom/htmlobjectelement.rs +++ b/components/script/dom/htmlobjectelement.rs @@ -73,7 +73,7 @@ trait ProcessDataURL { fn process_data_url(&self); } -impl<'a> ProcessDataURL for &'a HTMLObjectElement { +impl ProcessDataURL for &HTMLObjectElement { // Makes the local `data` member match the status of the `data` attribute and starts /// prefetching the image. This method must be called after `data` is changed. fn process_data_url(&self) { diff --git a/components/script/dom/oscillatornode.rs b/components/script/dom/oscillatornode.rs index 6cc0559cbed..c9b349e4e60 100644 --- a/components/script/dom/oscillatornode.rs +++ b/components/script/dom/oscillatornode.rs @@ -157,7 +157,7 @@ impl OscillatorNodeMethods for OscillatorNode { } } -impl<'a> Convert for &'a OscillatorOptions { +impl Convert for &OscillatorOptions { fn convert(self) -> ServoMediaOscillatorOptions { ServoMediaOscillatorOptions { oscillator_type: self.type_.convert(), diff --git a/components/script/dom/pannernode.rs b/components/script/dom/pannernode.rs index 2912cb4a474..5600342bc15 100644 --- a/components/script/dom/pannernode.rs +++ b/components/script/dom/pannernode.rs @@ -373,7 +373,7 @@ impl PannerNodeMethods for PannerNode { } } -impl<'a> Convert for &'a PannerOptions { +impl Convert for &PannerOptions { fn convert(self) -> PannerNodeOptions { PannerNodeOptions { panning_model: self.panningModel.convert(), diff --git a/components/script/dom/rtcpeerconnection.rs b/components/script/dom/rtcpeerconnection.rs index 689626f10d2..6495d9e1ec5 100644 --- a/components/script/dom/rtcpeerconnection.rs +++ b/components/script/dom/rtcpeerconnection.rs @@ -837,7 +837,7 @@ impl Convert for SessionDescription { } } -impl<'a> Convert for &'a RTCSessionDescriptionInit { +impl Convert for &RTCSessionDescriptionInit { fn convert(self) -> SessionDescription { let type_ = match self.type_ { RTCSdpType::Answer => SdpType::Answer, diff --git a/components/script/dom/servoparser/html.rs b/components/script/dom/servoparser/html.rs index 9d0b331fab2..b4102a2c153 100644 --- a/components/script/dom/servoparser/html.rs +++ b/components/script/dom/servoparser/html.rs @@ -212,7 +212,7 @@ impl Iterator for SerializationIterator { } } -impl<'a> Serialize for &'a Node { +impl Serialize for &Node { fn serialize( &self, serializer: &mut S, diff --git a/components/script/dom/treewalker.rs b/components/script/dom/treewalker.rs index 036c8987633..36127c1ad1b 100644 --- a/components/script/dom/treewalker.rs +++ b/components/script/dom/treewalker.rs @@ -456,7 +456,7 @@ impl TreeWalker { } } -impl<'a> Iterator for &'a TreeWalker { +impl Iterator for &TreeWalker { type Item = DomRoot; fn next(&mut self) -> Option> { diff --git a/components/script/dom/webgl_validations/tex_image_2d.rs b/components/script/dom/webgl_validations/tex_image_2d.rs index c8ab11b87d8..2fad80a8b34 100644 --- a/components/script/dom/webgl_validations/tex_image_2d.rs +++ b/components/script/dom/webgl_validations/tex_image_2d.rs @@ -107,7 +107,7 @@ pub struct CommonTexImage2DValidatorResult { pub border: u32, } -impl<'a> WebGLValidator for CommonTexImage2DValidator<'a> { +impl WebGLValidator for CommonTexImage2DValidator<'_> { type Error = TexImageValidationError; type ValidatedOutput = CommonTexImage2DValidatorResult; fn validate(self) -> Result { @@ -299,7 +299,7 @@ pub struct TexImage2DValidatorResult { /// TexImage2d validator as per /// -impl<'a> WebGLValidator for TexImage2DValidator<'a> { +impl WebGLValidator for TexImage2DValidator<'_> { type ValidatedOutput = TexImage2DValidatorResult; type Error = TexImageValidationError; @@ -459,7 +459,7 @@ fn is_subimage_blockaligned( (height % block_height == 0 || yoffset + height == tex_info.height()) } -impl<'a> WebGLValidator for CommonCompressedTexImage2DValidator<'a> { +impl WebGLValidator for CommonCompressedTexImage2DValidator<'_> { type Error = TexImageValidationError; type ValidatedOutput = CommonCompressedTexImage2DValidatorResult; @@ -537,7 +537,7 @@ impl<'a> CompressedTexImage2DValidator<'a> { } } -impl<'a> WebGLValidator for CompressedTexImage2DValidator<'a> { +impl WebGLValidator for CompressedTexImage2DValidator<'_> { type Error = TexImageValidationError; type ValidatedOutput = CommonCompressedTexImage2DValidatorResult; @@ -617,7 +617,7 @@ impl<'a> CompressedTexSubImage2DValidator<'a> { } } -impl<'a> WebGLValidator for CompressedTexSubImage2DValidator<'a> { +impl WebGLValidator for CompressedTexSubImage2DValidator<'_> { type Error = TexImageValidationError; type ValidatedOutput = CommonCompressedTexImage2DValidatorResult; @@ -728,7 +728,7 @@ impl<'a> TexStorageValidator<'a> { } } -impl<'a> WebGLValidator for TexStorageValidator<'a> { +impl WebGLValidator for TexStorageValidator<'_> { type Error = TexImageValidationError; type ValidatedOutput = TexStorageValidatorResult; diff --git a/components/script/layout_dom/element.rs b/components/script/layout_dom/element.rs index ec95cf0458b..5c5a6da9677 100644 --- a/components/script/layout_dom/element.rs +++ b/components/script/layout_dom/element.rs @@ -56,7 +56,7 @@ pub struct ServoLayoutElement<'dom> { element: LayoutDom<'dom, Element>, } -impl<'dom> fmt::Debug for ServoLayoutElement<'dom> { +impl fmt::Debug for ServoLayoutElement<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "<{}", self.element.local_name())?; if let Some(id) = self.id() { @@ -800,7 +800,7 @@ impl<'dom> ThreadSafeLayoutElement<'dom> for ServoThreadSafeLayoutElement<'dom> /// /// Note that the element implementation is needed only for selector matching, /// not for inheritance (styles are inherited appropriately). -impl<'dom> ::selectors::Element for ServoThreadSafeLayoutElement<'dom> { +impl ::selectors::Element for ServoThreadSafeLayoutElement<'_> { type Impl = SelectorImpl; fn opaque(&self) -> ::selectors::OpaqueElement { diff --git a/components/script/layout_dom/node.rs b/components/script/layout_dom/node.rs index 0b2b939cda4..20993d7263c 100644 --- a/components/script/layout_dom/node.rs +++ b/components/script/layout_dom/node.rs @@ -59,7 +59,7 @@ pub struct ServoLayoutNode<'dom> { unsafe impl Send for ServoLayoutNode<'_> {} unsafe impl Sync for ServoLayoutNode<'_> {} -impl<'dom> fmt::Debug for ServoLayoutNode<'dom> { +impl fmt::Debug for ServoLayoutNode<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { if let Some(el) = self.as_element() { el.fmt(f) @@ -95,7 +95,7 @@ impl<'dom> ServoLayoutNode<'dom> { } } -impl<'dom> style::dom::NodeInfo for ServoLayoutNode<'dom> { +impl style::dom::NodeInfo for ServoLayoutNode<'_> { fn is_element(&self) -> bool { self.node.is_element_for_layout() } @@ -262,7 +262,7 @@ impl<'dom> ServoThreadSafeLayoutNode<'dom> { } } -impl<'dom> style::dom::NodeInfo for ServoThreadSafeLayoutNode<'dom> { +impl style::dom::NodeInfo for ServoThreadSafeLayoutNode<'_> { fn is_element(&self) -> bool { self.node.is_element() } diff --git a/components/script/layout_dom/shadow_root.rs b/components/script/layout_dom/shadow_root.rs index 0763e150eff..4c42db9d941 100644 --- a/components/script/layout_dom/shadow_root.rs +++ b/components/script/layout_dom/shadow_root.rs @@ -18,7 +18,7 @@ pub struct ServoShadowRoot<'dom> { shadow_root: LayoutDom<'dom, ShadowRoot>, } -impl<'dom> fmt::Debug for ServoShadowRoot<'dom> { +impl fmt::Debug for ServoShadowRoot<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.as_node().fmt(f) } diff --git a/components/script/lib.rs b/components/script/lib.rs index 360e5e492ad..e406eb084fb 100644 --- a/components/script/lib.rs +++ b/components/script/lib.rs @@ -11,7 +11,6 @@ #![register_tool(crown)] #![cfg_attr(any(doc, clippy), allow(unknown_lints))] #![deny(crown_is_not_used)] -#![allow(clippy::needless_lifetimes)] // These are used a lot so let's keep them for now #[macro_use] diff --git a/components/script/realms.rs b/components/script/realms.rs index 11171051025..5fb2b42e7d0 100644 --- a/components/script/realms.rs +++ b/components/script/realms.rs @@ -33,7 +33,7 @@ pub enum InRealm<'a> { Entered(&'a JSAutoRealm), } -impl<'a> InRealm<'a> { +impl InRealm<'_> { pub fn already(token: &AlreadyInRealm) -> InRealm { InRealm::Already(token) } diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 29ceee67501..8a820a7b6bd 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -463,7 +463,7 @@ impl<'a> ScriptMemoryFailsafe<'a> { } } -impl<'a> Drop for ScriptMemoryFailsafe<'a> { +impl Drop for ScriptMemoryFailsafe<'_> { #[allow(crown::unrooted_must_root)] fn drop(&mut self) { if let Some(owner) = self.owner { diff --git a/components/script/stylesheet_loader.rs b/components/script/stylesheet_loader.rs index 20cfc1f2f37..f31201bb4fc 100644 --- a/components/script/stylesheet_loader.rs +++ b/components/script/stylesheet_loader.rs @@ -302,7 +302,7 @@ impl<'a> StylesheetLoader<'a> { } } -impl<'a> StylesheetLoader<'a> { +impl StylesheetLoader<'_> { pub fn load( &self, source: StylesheetContextSource, @@ -373,7 +373,7 @@ pub(crate) fn stylesheet_fetch_request( .integrity_metadata(integrity_metadata) } -impl<'a> StyleStylesheetLoader for StylesheetLoader<'a> { +impl StyleStylesheetLoader for StylesheetLoader<'_> { /// Request a stylesheet after parsing a given `@import` rule, and return /// the constructed `@import` rule. fn request_stylesheet( diff --git a/components/script/stylesheet_set.rs b/components/script/stylesheet_set.rs index ddb2f608e57..c4794b62d12 100644 --- a/components/script/stylesheet_set.rs +++ b/components/script/stylesheet_set.rs @@ -18,7 +18,7 @@ where Document(&'a mut DocumentStylesheetSet), } -impl<'a, S> StylesheetSetRef<'a, S> +impl StylesheetSetRef<'_, S> where S: StylesheetInDocument + PartialEq + 'static, { diff --git a/components/script/xpath/context.rs b/components/script/xpath/context.rs index 90873a89776..09bd36ded60 100644 --- a/components/script/xpath/context.rs +++ b/components/script/xpath/context.rs @@ -78,7 +78,7 @@ pub struct EvalNodesetIter<'a> { size: usize, } -impl<'a> Iterator for EvalNodesetIter<'a> { +impl Iterator for EvalNodesetIter<'_> { type Item = EvaluationCtx; fn next(&mut self) -> Option { diff --git a/components/webdriver_server/lib.rs b/components/webdriver_server/lib.rs index f77628fb705..0536b320e2d 100644 --- a/components/webdriver_server/lib.rs +++ b/components/webdriver_server/lib.rs @@ -5,7 +5,6 @@ #![crate_name = "webdriver_server"] #![crate_type = "rlib"] #![deny(unsafe_code)] -#![allow(clippy::needless_lifetimes)] mod actions; mod capabilities; @@ -313,7 +312,7 @@ impl<'de> Deserialize<'de> for WebDriverPrefValue { { struct Visitor; - impl<'de> ::serde::de::Visitor<'de> for Visitor { + impl ::serde::de::Visitor<'_> for Visitor { type Value = WebDriverPrefValue; fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {