Skip to content

Commit

Permalink
Make Clippy happy for 1.83 Rust (#427)
Browse files Browse the repository at this point in the history
  • Loading branch information
tyranron authored Nov 29, 2024
1 parent 6844e63 commit 604dba8
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion impl/src/as/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ struct Expansion<'a> {
conversions: Option<attr::Conversion>,
}

impl<'a> ToTokens for Expansion<'a> {
impl ToTokens for Expansion<'_> {
fn to_tokens(&self, tokens: &mut TokenStream) {
let field_ty = &self.field.ty;
let field_ident = self.field.ident.as_ref().map_or_else(
Expand Down
2 changes: 1 addition & 1 deletion impl/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ impl<'input, 'state> ParsedFields<'input, 'state> {
}
}

impl<'input, 'state> ParsedFields<'input, 'state> {
impl ParsedFields<'_, '_> {
fn render_source_as_struct(&self) -> Option<TokenStream> {
let source = self.source?;
let ident = &self.data.members[source];
Expand Down
2 changes: 1 addition & 1 deletion impl/src/fmt/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ struct Expansion<'a> {
attr_name: &'a syn::Ident,
}

impl<'a> Expansion<'a> {
impl Expansion<'_> {
/// Validates attributes of this [`Expansion`] to be consistent.
fn validate_attrs(&self) -> syn::Result<()> {
if self.attr.fmt.is_some() {
Expand Down
2 changes: 1 addition & 1 deletion impl/src/fmt/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ struct Expansion<'a> {
trait_ident: &'a syn::Ident,
}

impl<'a> Expansion<'a> {
impl Expansion<'_> {
/// Generates [`Display::fmt()`] implementation for a struct or an enum variant.
///
/// # Errors
Expand Down
2 changes: 1 addition & 1 deletion impl/src/from.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ struct Expansion<'a> {
has_explicit_from: bool,
}

impl<'a> Expansion<'a> {
impl Expansion<'_> {
/// Expands [`From`] implementations for a struct or an enum variant.
fn expand(&self) -> syn::Result<TokenStream> {
use crate::utils::FieldsExt as _;
Expand Down
2 changes: 1 addition & 1 deletion impl/src/into.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ struct Expansion<'a> {
convs: ConversionsAttribute,
}

impl<'a> Expansion<'a> {
impl Expansion<'_> {
fn expand(self) -> syn::Result<TokenStream> {
let Self {
input_ident,
Expand Down
8 changes: 4 additions & 4 deletions impl/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ pub struct MultiVariantData<'input, 'state> {
pub infos: Vec<FullMetaInfo>,
}

impl<'input, 'state> MultiFieldData<'input, 'state> {
impl MultiFieldData<'_, '_> {
pub fn initializer<T: ToTokens>(&self, initializers: &[T]) -> TokenStream {
let MultiFieldData {
variant_type,
Expand Down Expand Up @@ -804,7 +804,7 @@ impl<'input, 'state> MultiFieldData<'input, 'state> {
}
}

impl<'input, 'state> SingleFieldData<'input, 'state> {
impl SingleFieldData<'_, '_> {
pub fn initializer<T: ToTokens>(&self, initializers: &[T]) -> TokenStream {
self.multi_field_data.initializer(initializers)
}
Expand Down Expand Up @@ -2306,7 +2306,7 @@ mod generics_search {
pub(crate) consts: HashSet<&'s syn::Ident>,
}

impl<'s> GenericsSearch<'s> {
impl GenericsSearch<'_> {
/// Checks the provided [`syn::Type`] to contain anything from this [`GenericsSearch`].
pub(crate) fn any_in(&self, ty: &syn::Type) -> bool {
let mut visitor = Visitor {
Expand All @@ -2327,7 +2327,7 @@ mod generics_search {
found: bool,
}

impl<'s, 'ast> Visit<'ast> for Visitor<'s> {
impl<'ast> Visit<'ast> for Visitor<'_> {
fn visit_type_path(&mut self, tp: &'ast syn::TypePath) {
self.found |= tp.path.get_ident().map_or(false, |ident| {
self.search.types.contains(ident) || self.search.consts.contains(ident)
Expand Down
2 changes: 1 addition & 1 deletion src/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ impl<'a, 'b> Padded<'a, 'b> {
}
}

impl<'a, 'b> Write for Padded<'a, 'b> {
impl Write for Padded<'_, '_> {
fn write_str(&mut self, s: &str) -> Result {
for s in s.split_inclusive('\n') {
if self.on_newline {
Expand Down
2 changes: 1 addition & 1 deletion src/vendor/thiserror/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
These are vendored files from the [`thiserror`] crate. The license files in this
directory only apply to the files in this subdirectory of `derive_more`.

[`thiserror`]: https://github.com/dtolnay/thiserror
[`thiserror`]: https://github.com/dtolnay/thiserror/blob/2.0.3
12 changes: 7 additions & 5 deletions src/vendor/thiserror/aserror.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::error::Error;

use core::panic::UnwindSafe;

#[doc(hidden)]
pub trait AsDynError<'a>: Sealed {
fn as_dyn_error(&self) -> &(dyn Error + 'a);
}
Expand Down Expand Up @@ -44,9 +45,10 @@ impl<'a> AsDynError<'a> for dyn Error + Send + Sync + UnwindSafe + 'a {
}
}

#[doc(hidden)]
pub trait Sealed {}
impl<'a, T: Error + 'a> Sealed for T {}
impl<'a> Sealed for dyn Error + 'a {}
impl<'a> Sealed for dyn Error + Send + 'a {}
impl<'a> Sealed for dyn Error + Send + Sync + 'a {}
impl<'a> Sealed for dyn Error + Send + Sync + UnwindSafe + 'a {}
impl<T: Error> Sealed for T {}
impl Sealed for dyn Error + '_ {}
impl Sealed for dyn Error + Send + '_ {}
impl Sealed for dyn Error + Send + Sync + '_ {}
impl Sealed for dyn Error + Send + Sync + UnwindSafe + '_ {}

0 comments on commit 604dba8

Please sign in to comment.