Elide lifetimes where possible after rustup (#34824)

The new version of rust allows us to elide some lifetimes and clippy is
now complaining about this. This change elides them where possible and
removes the clippy exceptions.

Fixes #34804.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson 2025-01-03 19:54:44 +01:00 committed by GitHub
parent 92026cb094
commit 621ddd749c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
57 changed files with 92 additions and 99 deletions

View file

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

View file

@ -42,7 +42,7 @@ pub struct LayoutContext<'a> {
Arc<RwLock<FnvHashMap<(ServoUrl, UsePlaceholder), WebRenderImageInfo>>>,
}
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

View file

@ -189,7 +189,7 @@ impl DisplayList {
}
}
impl<'a> DisplayListBuilder<'a> {
impl DisplayListBuilder<'_> {
fn wr(&mut self) -> &mut wr::DisplayListBuilder {
&mut self.display_list.wr
}

View file

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

View file

@ -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<LineItem>,

View file

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

View file

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

View file

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

View file

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

View file

@ -2922,7 +2922,7 @@ struct RowspanToDistribute<'a> {
measure: &'a CellOrTrackMeasure,
}
impl<'a> RowspanToDistribute<'a> {
impl RowspanToDistribute<'_> {
fn range(&self) -> Range<usize> {
self.coordinates.y..self.coordinates.y + self.cell.rowspan
}

View file

@ -30,7 +30,7 @@ impl<'a> RecalcStyle<'a> {
}
#[allow(unsafe_code)]
impl<'a, 'dom, E> DomTraversal<E> for RecalcStyle<'a>
impl<'dom, E> DomTraversal<E> for RecalcStyle<'_>
where
E: TElement,
E::ConcreteNode: 'dom + LayoutNode<'dom>,