From a820f75ff6ec9b3fd141d5737f8ae9c9f689d792 Mon Sep 17 00:00:00 2001 From: Idan Arye Date: Mon, 18 Sep 2023 19:14:20 +0300 Subject: [PATCH] Fix #113: Add `#[allow(clippy::used_underscore_binding)]` to build method and setter methods --- CHANGELOG.md | 2 ++ typed-builder-macro/src/struct_info.rs | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index abc85e49..d36704bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Add `#[allow(clippy::exhaustive_enums)]` to generated empty enums used for error "reporting" (see issue #112) - Add `#[automatically_derived]` to generated `impl`s (see issue #114) +- Add `#[allow(clippy::used_underscore_binding)]` to build method and setter + methods (see issue #113) ## 0.16.0 - 2023-08-26 ### Added diff --git a/typed-builder-macro/src/struct_info.rs b/typed-builder-macro/src/struct_info.rs index a9ad2726..b245d22c 100644 --- a/typed-builder-macro/src/struct_info.rs +++ b/typed-builder-macro/src/struct_info.rs @@ -272,6 +272,7 @@ impl<'a> StructInfo<'a> { impl #impl_generics #builder_name < #( #ty_generics ),* > #where_clause { #deprecated #doc + #[allow(clippy::used_underscore_binding)] pub fn #method_name (self, #param_list) -> #builder_name <#( #target_generics ),*> { let #field_name = (#arg_expr,); let ( #(#descructuring,)* ) = self.fields; @@ -497,7 +498,7 @@ impl<'a> StructInfo<'a> { #[automatically_derived] impl #impl_generics #builder_name #modified_ty_generics #where_clause { #build_method_doc - #[allow(clippy::default_trait_access)] + #[allow(clippy::default_trait_access, clippy::used_underscore_binding)] #build_method_visibility fn #build_method_name #build_method_generic (self) -> #output_type #build_method_where_clause { let ( #(#descructuring,)* ) = self.fields; #( #assignments )*