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

@ -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() {

View file

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

View file

@ -54,7 +54,7 @@ pub struct LayoutContext<'a> {
pub pending_images: Mutex<Vec<PendingImage>>,
}
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

View file

@ -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<ComputedValues>) {

View file

@ -192,7 +192,7 @@ pub struct FlowListRandomAccessMut<'a> {
cache: Vec<FlowRef>,
}
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() {

View file

@ -3353,7 +3353,7 @@ impl<'a> Iterator for InlineStyleIterator<'a> {
}
}
impl<'a> InlineStyleIterator<'a> {
impl InlineStyleIterator<'_> {
fn new(fragment: &Fragment) -> InlineStyleIterator {
InlineStyleIterator {
fragment,

View file

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

View file

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

View file

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

View file

@ -69,7 +69,7 @@ pub struct TextRunSlice<'a> {
pub range: Range<ByteIndex>,
}
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<ByteIndex> {

View file

@ -43,7 +43,7 @@ impl<'a> RecalcStyleAndConstructFlows<'a> {
}
#[allow(unsafe_code)]
impl<'a, 'dom, E> DomTraversal<E> for RecalcStyleAndConstructFlows<'a>
impl<'dom, E> DomTraversal<E> 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() {