Auto-fixed clippy::needless_lifetimes

`__CARGO_FIX_YOLO=1` is a hack, but it does help a lot with the tedious fixes where the result is fairly clear.

See https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes

```
__CARGO_FIX_YOLO=1 cargo clippy --fix --all-targets --workspace --exclude gstreamer-player --exclude i-slint-backend-linuxkms --exclude uefi-demo --exclude ffmpeg -- -A clippy::all -W clippy::needless_lifetimes

cargo fmt --all
```
This commit is contained in:
Yuri Astrakhan 2025-02-07 00:59:16 -05:00 committed by Olivier Goffart
parent 0a7d7907b3
commit 9621cae218
16 changed files with 32 additions and 34 deletions

View file

@ -746,7 +746,7 @@ pub struct PropertyLookupResult<'a> {
pub is_in_direct_base: bool,
}
impl<'a> PropertyLookupResult<'a> {
impl PropertyLookupResult<'_> {
pub fn is_valid(&self) -> bool {
self.property_type != Type::Invalid
}

View file

@ -22,7 +22,7 @@ pub trait LexingRule {
fn lex(&self, text: &str, state: &mut LexState) -> usize;
}
impl<'a> LexingRule for &'a str {
impl LexingRule for &str {
#[inline]
fn lex(&self, text: &str, _: &mut LexState) -> usize {
if text.starts_with(*self) {

View file

@ -468,12 +468,12 @@ pub struct ParentCtx<'a, T = ()> {
pub repeater_index: Option<RepeatedElementIdx>,
}
impl<'a, T> Clone for ParentCtx<'a, T> {
impl<T> Clone for ParentCtx<'_, T> {
fn clone(&self) -> Self {
*self
}
}
impl<'a, T> Copy for ParentCtx<'a, T> {}
impl<T> Copy for ParentCtx<'_, T> {}
impl<'a, T> ParentCtx<'a, T> {
pub fn new(
@ -686,7 +686,7 @@ impl<'a, T> EvaluationContext<'a, T> {
}
}
impl<'a, T> TypeResolutionContext for EvaluationContext<'a, T> {
impl<T> TypeResolutionContext for EvaluationContext<'_, T> {
fn property_ty(&self, prop: &PropertyReference) -> &Type {
match prop {
PropertyReference::Local { sub_component_path, property_index } => {

View file

@ -20,7 +20,7 @@ struct PrettyPrinter<'a> {
indentation: usize,
}
impl<'a> PrettyPrinter<'a> {
impl PrettyPrinter<'_> {
fn print_root(&mut self, root: &CompilationUnit) -> Result {
for (idx, g) in root.globals.iter_enumerated() {
if !g.is_builtin {

View file

@ -909,7 +909,7 @@ impl LookupObject for Expression {
}
struct StringExpression<'a>(&'a Expression);
impl<'a> LookupObject for StringExpression<'a> {
impl LookupObject for StringExpression<'_> {
fn for_each_entry<R>(
&self,
ctx: &LookupCtx,
@ -938,7 +938,7 @@ impl<'a> LookupObject for StringExpression<'a> {
}
}
struct ColorExpression<'a>(&'a Expression);
impl<'a> LookupObject for ColorExpression<'a> {
impl LookupObject for ColorExpression<'_> {
fn for_each_entry<R>(
&self,
ctx: &LookupCtx,
@ -987,7 +987,7 @@ impl<'a> LookupObject for ColorExpression<'a> {
}
struct ImageExpression<'a>(&'a Expression);
impl<'a> LookupObject for ImageExpression<'a> {
impl LookupObject for ImageExpression<'_> {
fn for_each_entry<R>(
&self,
ctx: &LookupCtx,
@ -1010,7 +1010,7 @@ impl<'a> LookupObject for ImageExpression<'a> {
}
struct ArrayExpression<'a>(&'a Expression);
impl<'a> LookupObject for ArrayExpression<'a> {
impl LookupObject for ArrayExpression<'_> {
fn for_each_entry<R>(
&self,
ctx: &LookupCtx,
@ -1031,7 +1031,7 @@ impl<'a> LookupObject for ArrayExpression<'a> {
/// An expression of type int or float
struct NumberExpression<'a>(&'a Expression);
impl<'a> LookupObject for NumberExpression<'a> {
impl LookupObject for NumberExpression<'_> {
fn for_each_entry<R>(
&self,
ctx: &LookupCtx,
@ -1061,7 +1061,7 @@ impl<'a> LookupObject for NumberExpression<'a> {
/// An expression of any numerical value with an unit
struct NumberWithUnitExpression<'a>(&'a Expression);
impl<'a> LookupObject for NumberWithUnitExpression<'a> {
impl LookupObject for NumberWithUnitExpression<'_> {
fn for_each_entry<R>(
&self,
ctx: &LookupCtx,

View file

@ -591,12 +591,12 @@ mod parser_trait {
/// and finishes the node on Drop
#[derive(derive_more::DerefMut)]
pub struct Node<'a, P: Parser>(&'a mut P);
impl<'a, P: Parser> Drop for Node<'a, P> {
impl<P: Parser> Drop for Node<'_, P> {
fn drop(&mut self) {
self.0.finish_node_impl(NodeToken(()));
}
}
impl<'a, P: Parser> core::ops::Deref for Node<'a, P> {
impl<P: Parser> core::ops::Deref for Node<'_, P> {
type Target = P;
fn deref(&self) -> &Self::Target {
self.0

View file

@ -41,7 +41,7 @@ struct DedupPropState<'a> {
counts: RefCell<PropertyReadCounts>,
}
impl<'a> DedupPropState<'a> {
impl DedupPropState<'_> {
fn add(&self, nr: &NamedReference) {
if self.parent_state.is_some_and(|pc| pc.add_from_children(nr)) {
return;