Skip to content

Commit

Permalink
Fix new nightly clippy lints
Browse files Browse the repository at this point in the history
(cherry picked from commit 22d9a4d)
  • Loading branch information
csnover committed Oct 13, 2024
1 parent 6ac9608 commit cd154b6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion binrw_derive/src/binrw/combiner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub(crate) fn derive(mut derive_input: DeriveInput) -> proc_macro2::TokenStream

// Since temporary fields must be synchronised between binread and binwrite,
// the same cleaning mechanism can be used as-if there was only one input
super::clean_attr(&mut derive_input, &binread_input.ok());
super::clean_attr(&mut derive_input, binread_input.ok().as_ref());

quote!(
#derive_input
Expand Down
8 changes: 4 additions & 4 deletions binrw_derive/src/binrw/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub(super) struct Options {
}

#[cfg_attr(coverage_nightly, coverage(off))]
fn clean_attr(derive_input: &mut DeriveInput, binrw_input: &Option<Input>) {
fn clean_attr(derive_input: &mut DeriveInput, binrw_input: Option<&Input>) {
clean_struct_attrs(&mut derive_input.attrs);

match &mut derive_input.data {
Expand All @@ -43,7 +43,7 @@ fn clean_attr(derive_input: &mut DeriveInput, binrw_input: &Option<Input>) {
}

#[cfg_attr(coverage_nightly, coverage(off))]
fn clean_field_attrs(input: &Option<Input>, variant_index: usize, fields: &mut syn::Fields) {
fn clean_field_attrs(input: Option<&Input>, variant_index: usize, fields: &mut syn::Fields) {
if let Some(input) = input {
let fields = match fields {
syn::Fields::Named(fields) => &mut fields.named,
Expand Down Expand Up @@ -128,12 +128,12 @@ pub(super) fn derive_from_input(

match &mut derive_input.data {
syn::Data::Struct(st) => {
clean_field_attrs(&binrw_input, 0, &mut st.fields);
clean_field_attrs(binrw_input.as_ref(), 0, &mut st.fields);
}
syn::Data::Enum(en) => {
for (index, variant) in en.variants.iter_mut().enumerate() {
clean_struct_attrs(&mut variant.attrs);
clean_field_attrs(&binrw_input, index, &mut variant.fields);
clean_field_attrs(binrw_input.as_ref(), index, &mut variant.fields);
}
}
syn::Data::Union(union) => {
Expand Down
2 changes: 1 addition & 1 deletion binrw_derive/src/named_args/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub(super) struct Builder<'a> {
pub(super) is_write: bool,
}

impl<'a> Builder<'a> {
impl Builder<'_> {
pub(super) fn generate(&self, define_result: bool) -> TokenStream {
let builder_name = self.builder_name;
let name = self.result_name;
Expand Down

0 comments on commit cd154b6

Please sign in to comment.