Skip to content

Commit 7e47e14

Browse files
committed
feat: finish with clippy
1 parent 769e985 commit 7e47e14

File tree

129 files changed

+1198
-561
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+1198
-561
lines changed

module/core/derive_tools/Readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Module :: derive_tools
1+
# Module :: `derive_tools`
22

33
<!--{ generate.module_header{} }-->
44
<!--{ generate.module_header.start() }-->

module/core/derive_tools/src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
// #[ cfg( feature = "enabled" ) ]
3232
// pub mod wtools;
3333

34-
#[ cfg( all( feature = "derive_more" ) ) ]
34+
#[ cfg( feature = "derive_more" ) ]
3535
#[ allow( unused_imports ) ]
3636
mod derive_more
3737
{
@@ -110,6 +110,7 @@ pub use own::*;
110110
#[ allow( unused_imports ) ]
111111
pub mod own
112112
{
113+
#[ allow( clippy::wildcard_imports ) ]
113114
use super::*;
114115
#[ doc( inline ) ]
115116
pub use orphan::*;
@@ -123,6 +124,7 @@ pub mod own
123124
#[ allow( unused_imports ) ]
124125
pub mod orphan
125126
{
127+
#[ allow( clippy::wildcard_imports ) ]
126128
use super::*;
127129
#[ doc( inline ) ]
128130
pub use exposed::*;
@@ -133,11 +135,12 @@ pub mod orphan
133135
#[ allow( unused_imports ) ]
134136
pub mod exposed
135137
{
138+
#[ allow( clippy::wildcard_imports ) ]
136139
use super::*;
137140
#[ doc( inline ) ]
138141
pub use prelude::*;
139142

140-
#[ cfg( all( feature = "derive_more" ) ) ]
143+
#[ cfg( feature = "derive_more" ) ]
141144
#[ doc( inline ) ]
142145
pub use super::derive_more::*;
143146

module/core/derive_tools_meta/Readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!-- {{# generate.module_header{} #}} -->
2-
# Module :: derive_tools_meta
2+
# Module :: `derive_tools_meta`
33
<!--{ generate.module_header.start() }-->
44
[![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) [![rust-status](https://github.com/Wandalen/wTools/actions/workflows/module_derive_tools_meta_push.yml/badge.svg)](https://github.com/Wandalen/wTools/actions/workflows/module_derive_tools_meta_push.yml) [![docs.rs](https://img.shields.io/docsrs/derive_tools_meta?color=e3e8f0&logo=docs.rs)](https://docs.rs/derive_tools_meta) [![discord](https://img.shields.io/discord/872391416519737405?color=eee&logo=discord&logoColor=eee&label=ask)](https://discord.gg/m3YfbXpUUY)
55
<!--{ generate.module_header.end }-->

module/core/derive_tools_meta/src/derive/as_ref.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11

2+
#[ allow( clippy::wildcard_imports ) ]
23
use super::*;
34
use macro_tools::{ attr, diag, item_struct, Result };
45

module/core/derive_tools_meta/src/derive/deref.rs

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#[ allow( clippy::wildcard_imports ) ]
12
use super::*;
23
use macro_tools::{ attr, diag, generic_params, Result, struct_like::StructLike };
34

@@ -11,7 +12,7 @@ pub fn deref( input : proc_macro::TokenStream ) -> Result< proc_macro2::TokenStr
1112
let item_name = &parsed.ident();
1213

1314
let ( _generics_with_defaults, generics_impl, generics_ty, generics_where )
14-
= generic_params::decompose( &parsed.generics() );
15+
= generic_params::decompose( parsed.generics() );
1516

1617
let result = match parsed
1718
{
@@ -84,6 +85,7 @@ pub fn deref( input : proc_macro::TokenStream ) -> Result< proc_macro2::TokenStr
8485
/// }
8586
/// ```
8687
///
88+
#[ allow( clippy::unnecessary_wraps ) ]
8789
fn generate_unit
8890
(
8991
item_name : &syn::Ident,
@@ -322,9 +324,9 @@ fn generate_enum
322324
None => return generate_unit
323325
(
324326
item_name,
325-
&generics_impl,
326-
&generics_ty,
327-
&generics_where,
327+
generics_impl,
328+
generics_ty,
329+
generics_where,
328330
),
329331
};
330332

@@ -343,18 +345,18 @@ fn generate_enum
343345
generate_unit
344346
(
345347
item_name,
346-
&generics_impl,
347-
&generics_ty,
348-
&generics_where,
348+
generics_impl,
349+
generics_ty,
350+
generics_where,
349351
),
350352

351353
syn::Fields::Unnamed( ref item ) =>
352354
generate_enum_tuple_variants
353355
(
354356
item_name,
355-
&generics_impl,
356-
&generics_ty,
357-
&generics_where,
357+
generics_impl,
358+
generics_ty,
359+
generics_where,
358360
&idents,
359361
item,
360362
),
@@ -363,9 +365,9 @@ fn generate_enum
363365
generate_enum_named_variants
364366
(
365367
item_name,
366-
&generics_impl,
367-
&generics_ty,
368-
&generics_where,
368+
generics_impl,
369+
generics_ty,
370+
generics_where,
369371
&idents,
370372
item,
371373
),

module/core/derive_tools_meta/src/derive/from.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#[ allow( clippy::wildcard_imports ) ]
12
use super::*;
23
use macro_tools::
34
{
@@ -10,6 +11,7 @@ use macro_tools::
1011
};
1112

1213
mod field_attributes;
14+
#[ allow( clippy::wildcard_imports ) ]
1315
use field_attributes::*;
1416
mod item_attributes;
1517
#[ allow( clippy::wildcard_imports ) ]
@@ -464,7 +466,7 @@ fn variant_generate
464466
return Ok( qt!{} )
465467
}
466468

467-
if fields.len() == 0
469+
if fields.is_empty()
468470
{
469471
return Ok( qt!{} )
470472
}

module/core/derive_tools_meta/src/derive/from/field_attributes.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#[ allow( clippy::wildcard_imports ) ]
12
use super::*;
23
use macro_tools::
34
{
@@ -25,6 +26,7 @@ pub struct FieldAttributes
2526
impl FieldAttributes
2627
{
2728

29+
#[ allow( clippy::single_match ) ]
2830
pub fn from_attrs< 'a >( attrs : impl Iterator< Item = &'a syn::Attribute > ) -> Result< Self >
2931
{
3032
let mut result = Self::default();
@@ -50,7 +52,7 @@ impl FieldAttributes
5052
{
5153

5254
let key_ident = attr.path().get_ident().ok_or_else( || error( attr ) )?;
53-
let key_str = format!( "{}", key_ident );
55+
let key_str = format!( "{key_ident}" );
5456

5557
// attributes does not have to be known
5658
// if attr::is_standard( &key_str )
@@ -61,7 +63,7 @@ impl FieldAttributes
6163
match key_str.as_ref()
6264
{
6365
FieldAttributeConfig::KEYWORD => result.assign( FieldAttributeConfig::from_meta( attr )? ),
64-
"debug" => {},
66+
// "debug" => {},
6567
_ => {},
6668
// _ => return Err( error( attr ) ),
6769
}
@@ -95,17 +97,18 @@ impl AttributeComponent for FieldAttributeConfig
9597
{
9698
const KEYWORD : &'static str = "from";
9799

100+
#[ allow( clippy::match_wildcard_for_single_variants ) ]
98101
fn from_meta( attr : &syn::Attribute ) -> Result< Self >
99102
{
100103
match attr.meta
101104
{
102105
syn::Meta::List( ref meta_list ) =>
103106
{
104-
return syn::parse2::< FieldAttributeConfig >( meta_list.tokens.clone() );
107+
syn::parse2::< FieldAttributeConfig >( meta_list.tokens.clone() )
105108
},
106109
syn::Meta::Path( ref _path ) =>
107110
{
108-
return Ok( Default::default() )
111+
Ok( FieldAttributeConfig::default() )
109112
},
110113
_ => return_syn_err!( attr, "Expects an attribute of format `#[ from( on ) ]`. \nGot: {}", qt!{ #attr } ),
111114
}

module/core/derive_tools_meta/src/derive/from/item_attributes.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#[ allow( clippy::wildcard_imports ) ]
12
use super::*;
23
use macro_tools::
34
{
@@ -23,6 +24,7 @@ pub struct ItemAttributes
2324
impl ItemAttributes
2425
{
2526

27+
#[ allow( clippy::single_match ) ]
2628
pub fn from_attrs< 'a >( attrs : impl Iterator< Item = &'a syn::Attribute > ) -> Result< Self >
2729
{
2830
let mut result = Self::default();
@@ -48,7 +50,7 @@ impl ItemAttributes
4850
{
4951

5052
let key_ident = attr.path().get_ident().ok_or_else( || error( attr ) )?;
51-
let key_str = format!( "{}", key_ident );
53+
let key_str = format!( "{key_ident}" );
5254

5355
// attributes does not have to be known
5456
// if attr::is_standard( &key_str )
@@ -59,7 +61,7 @@ impl ItemAttributes
5961
match key_str.as_ref()
6062
{
6163
ItemAttributeConfig::KEYWORD => result.assign( ItemAttributeConfig::from_meta( attr )? ),
62-
"debug" => {}
64+
// "debug" => {}
6365
_ => {},
6466
// _ => return Err( error( attr ) ),
6567
// attributes does not have to be known
@@ -99,7 +101,7 @@ impl AttributeComponent for ItemAttributeConfig
99101
{
100102
syn::Meta::List( ref meta_list ) =>
101103
{
102-
syn::parse2::< ItemAttributeConfig >( meta_list.tokens.clone() );
104+
syn::parse2::< ItemAttributeConfig >( meta_list.tokens.clone() )
103105
},
104106
syn::Meta::Path( ref _path ) =>
105107
{

module/core/former/Readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ This approach abstracts away the need for manually implementing a builder for ea
2323

2424
## Comparison
2525

26-
The Former crate and the abstract Builder pattern concept share a common goal: to construct complex objects step-by-step, ensuring they are always in a valid state and hiding internal structures. Both use a fluent interface for setting fields and support default values for fields that aren't explicitly set. They also have a finalization method to return the constructed object (.form() in Former, build() in [traditional Builder](https://refactoring.guru/design-patterns/builder)).
26+
The Former crate and the abstract Builder pattern concept share a common goal: to construct complex objects step-by-step, ensuring they are always in a valid state and hiding internal structures. Both use a fluent interface for setting fields and support default values for fields that aren't explicitly set. They also have a finalization method to return the constructed object (`.form()` in Former, `build()` in [traditional Builder](https://refactoring.guru/design-patterns/builder)).
2727

2828
However, the Former crate extends the traditional Builder pattern by automating the generation of builder methods using macros. This eliminates the need for manual implementation, which is often required in the abstract concept. Additionally, Former supports nested builders and subformers for complex data structures, allowing for more sophisticated object construction.
2929

@@ -660,7 +660,7 @@ Storage is not just a passive collection; it is an active part of a larger ecosy
660660

661661
- **Former as an Active Manager**: The former is responsible for managing the storage, utilizing it to keep track of the object's evolving configuration. It orchestrates the formation process by handling intermediate states and preparing the object for its final form.
662662
- **Contextual Flexibility**: The context associated with the former adds an additional layer of flexibility, allowing the former to adjust its behavior based on the broader circumstances of the object's formation. This is particularly useful when the forming process involves conditions or states external to the object itself.
663-
- **FormingEnd Callback**: The `FormingEnd` callback is a dynamic component that defines the final steps of the forming process. It can modify the storage based on final adjustments, validate the object's readiness, or integrate the object into a larger structure, such as embedding it as a subformer within another structure.
663+
- **`FormingEnd` Callback**: The `FormingEnd` callback is a dynamic component that defines the final steps of the forming process. It can modify the storage based on final adjustments, validate the object's readiness, or integrate the object into a larger structure, such as embedding it as a subformer within another structure.
664664

665665
These elements work in concert to ensure that the forming process is not only about building an object step-by-step but also about integrating it seamlessly into larger, more complex structures or systems.
666666

module/core/former/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ pub use own::*;
2222
#[ allow( unused_imports ) ]
2323
pub mod own
2424
{
25+
#[ allow( clippy::wildcard_imports ) ]
2526
use super::*;
2627
#[ doc( inline ) ]
2728
pub use orphan::*;
@@ -35,6 +36,7 @@ pub mod own
3536
#[ allow( unused_imports ) ]
3637
pub mod orphan
3738
{
39+
#[ allow( clippy::wildcard_imports ) ]
3840
use super::*;
3941
#[ doc( inline ) ]
4042
pub use exposed::*;
@@ -45,6 +47,7 @@ pub mod orphan
4547
#[ allow( unused_imports ) ]
4648
pub mod exposed
4749
{
50+
#[ allow( clippy::wildcard_imports ) ]
4851
use super::*;
4952

5053
#[ doc( inline ) ]

0 commit comments

Comments
 (0)