Skip to content

Commit

Permalink
Fix clippy violations by removing unnecessary iifetimes
Browse files Browse the repository at this point in the history
  • Loading branch information
TedDriggs committed Dec 2, 2024
1 parent b746a0c commit b7a248f
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion core/src/ast/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ impl From<syn::Fields> for Style {
}
}

impl<'a> From<&'a syn::Fields> for Style {
impl From<&syn::Fields> for Style {
fn from(vd: &syn::Fields) -> Self {
match *vd {
syn::Fields::Named(_) => Style::Struct,
Expand Down
4 changes: 2 additions & 2 deletions core/src/codegen/default_expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl<'a> DefaultExpression<'a> {
}
}

impl<'a> ToTokens for DefaultExpression<'a> {
impl ToTokens for DefaultExpression<'_> {
fn to_tokens(&self, tokens: &mut TokenStream) {
tokens.append_all(match *self {
DefaultExpression::Inherit(ident) => {
Expand All @@ -44,7 +44,7 @@ impl<'a> ToTokens for DefaultExpression<'a> {
/// Used only by containers, this wrapper type generates code to declare the fallback instance.
pub struct DefaultDeclaration<'a>(&'a DefaultExpression<'a>);

impl<'a> ToTokens for DefaultDeclaration<'a> {
impl ToTokens for DefaultDeclaration<'_> {
fn to_tokens(&self, tokens: &mut TokenStream) {
let name = Ident::new(DEFAULT_STRUCT_NAME, ::proc_macro2::Span::call_site());
let expr = self.0;
Expand Down
2 changes: 1 addition & 1 deletion core/src/codegen/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl<'a> ErrorCheck<'a> {
}
}

impl<'a> ToTokens for ErrorCheck<'a> {
impl ToTokens for ErrorCheck<'_> {
fn to_tokens(&self, tokens: &mut TokenStream) {
let at_call = if let Some(ref s) = self.location {
quote!(.map_err(|e| e.at(#s)))
Expand Down
12 changes: 6 additions & 6 deletions core/src/codegen/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl<'a> Field<'a> {
}
}

impl<'a> UsesTypeParams for Field<'a> {
impl UsesTypeParams for Field<'_> {
fn uses_type_params<'b>(
&self,
options: &usage::Options,
Expand All @@ -87,7 +87,7 @@ impl<'a> UsesTypeParams for Field<'a> {
/// An individual field during variable declaration in the generated parsing method.
pub struct Declaration<'a>(&'a Field<'a>);

impl<'a> ToTokens for Declaration<'a> {
impl ToTokens for Declaration<'_> {
fn to_tokens(&self, tokens: &mut TokenStream) {
let field = self.0;
let ident = field.ident;
Expand Down Expand Up @@ -118,7 +118,7 @@ pub struct FlattenInitializer<'a> {
parent_field_names: Vec<&'a str>,
}

impl<'a> ToTokens for FlattenInitializer<'a> {
impl ToTokens for FlattenInitializer<'_> {
fn to_tokens(&self, tokens: &mut TokenStream) {
let Self {
field,
Expand Down Expand Up @@ -147,7 +147,7 @@ impl<'a> ToTokens for FlattenInitializer<'a> {
/// Represents an individual field in the match.
pub struct MatchArm<'a>(&'a Field<'a>);

impl<'a> ToTokens for MatchArm<'a> {
impl ToTokens for MatchArm<'_> {
fn to_tokens(&self, tokens: &mut TokenStream) {
let field = self.0;

Expand Down Expand Up @@ -216,7 +216,7 @@ impl<'a> ToTokens for MatchArm<'a> {
/// Wrapper to generate initialization code for a field.
pub struct Initializer<'a>(&'a Field<'a>);

impl<'a> ToTokens for Initializer<'a> {
impl ToTokens for Initializer<'_> {
fn to_tokens(&self, tokens: &mut TokenStream) {
let field = self.0;
let ident = field.ident;
Expand Down Expand Up @@ -245,7 +245,7 @@ impl<'a> ToTokens for Initializer<'a> {
/// Creates an error if a field has no value and no default.
pub struct CheckMissing<'a>(&'a Field<'a>);

impl<'a> ToTokens for CheckMissing<'a> {
impl ToTokens for CheckMissing<'_> {
fn to_tokens(&self, tokens: &mut TokenStream) {
if !self.0.multiple && self.0.default_expression.is_none() {
let ident = self.0.ident;
Expand Down
2 changes: 1 addition & 1 deletion core/src/codegen/from_attributes_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl ToTokens for FromAttributesImpl<'_> {
}
}

impl<'a> ExtractAttribute for FromAttributesImpl<'a> {
impl ExtractAttribute for FromAttributesImpl<'_> {
fn local_declarations(&self) -> TokenStream {
self.base.local_declarations()
}
Expand Down
4 changes: 2 additions & 2 deletions core/src/codegen/from_derive_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub struct FromDeriveInputImpl<'a> {
pub supports: Option<&'a DeriveInputShapeSet>,
}

impl<'a> ToTokens for FromDeriveInputImpl<'a> {
impl ToTokens for FromDeriveInputImpl<'_> {
fn to_tokens(&self, tokens: &mut TokenStream) {
let ty_ident = self.base.ident;
let input = self.param_name();
Expand Down Expand Up @@ -115,7 +115,7 @@ impl<'a> ToTokens for FromDeriveInputImpl<'a> {
}
}

impl<'a> ExtractAttribute for FromDeriveInputImpl<'a> {
impl ExtractAttribute for FromDeriveInputImpl<'_> {
fn attr_names(&self) -> &PathList {
self.attr_names
}
Expand Down
4 changes: 2 additions & 2 deletions core/src/codegen/from_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub struct FromFieldImpl<'a> {
pub from_ident: bool,
}

impl<'a> ToTokens for FromFieldImpl<'a> {
impl ToTokens for FromFieldImpl<'_> {
fn to_tokens(&self, tokens: &mut TokenStream) {
let input = self.param_name();

Expand Down Expand Up @@ -77,7 +77,7 @@ impl<'a> ToTokens for FromFieldImpl<'a> {
}
}

impl<'a> ExtractAttribute for FromFieldImpl<'a> {
impl ExtractAttribute for FromFieldImpl<'_> {
fn attr_names(&self) -> &PathList {
self.attr_names
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/codegen/from_meta_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub struct FromMetaImpl<'a> {
pub base: TraitImpl<'a>,
}

impl<'a> ToTokens for FromMetaImpl<'a> {
impl ToTokens for FromMetaImpl<'_> {
fn to_tokens(&self, tokens: &mut TokenStream) {
let base = &self.base;

Expand Down
4 changes: 2 additions & 2 deletions core/src/codegen/from_type_param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub struct FromTypeParamImpl<'a> {
pub from_ident: bool,
}

impl<'a> ToTokens for FromTypeParamImpl<'a> {
impl ToTokens for FromTypeParamImpl<'_> {
fn to_tokens(&self, tokens: &mut TokenStream) {
let input = self.param_name();

Expand Down Expand Up @@ -74,7 +74,7 @@ impl<'a> ToTokens for FromTypeParamImpl<'a> {
}
}

impl<'a> ExtractAttribute for FromTypeParamImpl<'a> {
impl ExtractAttribute for FromTypeParamImpl<'_> {
fn attr_names(&self) -> &PathList {
self.attr_names
}
Expand Down
4 changes: 2 additions & 2 deletions core/src/codegen/from_variant_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub struct FromVariantImpl<'a> {
pub supports: Option<&'a DataShape>,
}

impl<'a> ToTokens for FromVariantImpl<'a> {
impl ToTokens for FromVariantImpl<'_> {
fn to_tokens(&self, tokens: &mut TokenStream) {
let input = self.param_name();
let extractor = self.extractor();
Expand Down Expand Up @@ -97,7 +97,7 @@ impl<'a> ToTokens for FromVariantImpl<'a> {
}
}

impl<'a> ExtractAttribute for FromVariantImpl<'a> {
impl ExtractAttribute for FromVariantImpl<'_> {
fn local_declarations(&self) -> TokenStream {
self.base.local_declarations()
}
Expand Down
12 changes: 6 additions & 6 deletions core/src/codegen/variant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl<'a> Variant<'a> {
}
}

impl<'a> UsesTypeParams for Variant<'a> {
impl UsesTypeParams for Variant<'_> {
fn uses_type_params<'b>(
&self,
options: &usage::Options,
Expand All @@ -57,7 +57,7 @@ impl<'a> UsesTypeParams for Variant<'a> {
}
}

impl<'a> ToTokens for Variant<'a> {
impl ToTokens for Variant<'_> {
fn to_tokens(&self, tokens: &mut TokenStream) {
if self.data.is_unit() {
self.as_unit_match_arm().to_tokens(tokens);
Expand All @@ -72,9 +72,9 @@ impl<'a> ToTokens for Variant<'a> {
/// Value-carrying variants wrapped in this type will emit code to produce an "unsupported format" error.
pub struct UnitMatchArm<'a>(&'a Variant<'a>);

impl<'a> ToTokens for UnitMatchArm<'a> {
impl ToTokens for UnitMatchArm<'_> {
fn to_tokens(&self, tokens: &mut TokenStream) {
let val: &Variant<'a> = self.0;
let val: &Variant<'_> = self.0;

if val.skip {
return;
Expand Down Expand Up @@ -128,9 +128,9 @@ impl<'a> ToTokens for UnitMatchArm<'a> {
/// Unit variants wrapped in this type will emit code to produce an "unsupported format" error.
pub struct DataMatchArm<'a>(&'a Variant<'a>);

impl<'a> ToTokens for DataMatchArm<'a> {
impl ToTokens for DataMatchArm<'_> {
fn to_tokens(&self, tokens: &mut TokenStream) {
let val: &Variant<'a> = self.0;
let val: &Variant<'_> = self.0;

if val.skip {
return;
Expand Down
2 changes: 1 addition & 1 deletion core/src/util/ident_string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ impl PartialEq<String> for IdentString {
}
}

impl<'a> PartialEq<&'a str> for IdentString {
impl PartialEq<&str> for IdentString {
fn eq(&self, rhs: &&str) -> bool {
self.as_str() == *rhs
}
Expand Down

0 comments on commit b7a248f

Please sign in to comment.